## Divide first n square numbers 1^2, 2^2, ……. n^2 into two groups such that absolute difference of the sum of the two groups is minimum [closed]

lets say Given input is n = 6 (n is as large as 100000) My task is to divide {1, 4, 9, 16, 25, 36} into two groups and PRINT these two groups

Possible Solution 1: dividing groups as {1, 9, 36} and {4, 16, 25} which gives abs diff as abs(46 – 45) = 1. So the minimum difference is 1 and the two groups are {1, 9, 36} and {4, 16, 25}

Possible Solution 2: Another Possible Solution is dividing groups as {9, 36} and {1, 4, 16, 25} which gives abs diff as abs(45 – 46) = 1. So the minimum difference is 1 and the two groups are {9, 36} and {1, 4, 16, 25}.

If there are multiple solutions we can print any one. Iam trying to solve it using https://www.geeksforgeeks.org/divide-1-n-two-groups-minimum-sum-difference/ but its not working.

I know that min difference is always 0 or 1 for n >= 6 but how to divide them into two groups.

And can we extend this problem to cubes, fourth powers, so on. if so what is the strategy used

## Divide first n square numbers 1^3, 2^3, … n^3 into two groups such that absolute difference of the sum of the two groups is minimum

lets say Given input is n = 3 (n is as large as 100000) My task is to divide {1, 8, 27} into two groups and PRINT these two groups

Possible Solution : dividing groups as {1, 8} and {27} how to print these two groups?

## Is There Data on How Quickly Roleplaying Groups Move through Published Modules?

Obviously there are huge variations in how different groups approach adventures in tabletop games, different preferences and styles for DMs, and other factors that affect how much time (measured in sessions or hours) gaming groups spend playing through specific adventure modules.

In trying to assess the pacing of campaigns in which I’m involved (as a DM or player), I became curious about what others’ experiences have been playing through published modules – the published content is the same for everybody, so play style seems like it would drive most of the differences in play time. I’ve looked around a bit but have mostly found things like isolated Reddit threads where two or three people (at most) describe their singular experiences, and not always containing useful information about time.

Is there any data on typical time spent playing specific adventure modules in 5e?

Ideally this would be survey data describing completed campaigns, with some standardized way of estimating the amount of "off-book" content that was added (though I’d be surprised to see a survey that would try to gather that last one, as it’s hard to operationalize). Even more ideal would be data that includes player feelings about the length (such as 100 hours of play for 60% of respondents, and among those 30% of players would have preferred more play hours in the module).

If such data exists, I’m interested in any published module. My intended use is to compare the information to the length of the adventures as described in the source books, to set some loose bounds on how I might calibrate my own campaign pacing. Online or offline play, I’m interested in whatever is available.

## What is the best way to identify highly performing groups?

I am currently working on a project that involves sorting people into groups based on their ability to work well with others.

While it is a bit of a simplification, I have a problem that is essentially as follows:

Let us say we have 100 people. These people have to complete a task, and will subsequently receive a score depending on how well they performed. In order to complete the task, the participants are allowed to form groups of up to 5. When they collectively complete the task, they will also receive a single score. How can I identify (1) individuals that have a high capacity for teamwork; and (2) specific groups that are extremely good at performing said task (by receiving high scores)?

I’ve given it some thought but not many good answers come to mind. For example, I could make all the possible combinations of groups of 2, 3, 4, and 5 and try to identify such high performance groups. However, the number of combinations is astronomical and so I would like to determine a more elegant solution.

## Dividing students into 4 groups based on preferences is NP-complete

Given a set of students $$H$$ of size $$n$$, and a set $$E \subseteq H \times H$$ of pairs of students that dislike each other, we want to determine whether it’s possible to divide them into $$4$$ groups such that:

• no two students that dislike each other end up in the same group,
• the size of each group must be at least $$\frac{n}{5}$$.

I want to prove that this problem is NP-complete. I suspect that I could use the NP-completeness of the independence set problem, yet I have some problems with finding an appropriate reduction.

Let $$G = (H, E)$$ an undirected graph – each edge represents two students that dislike each other.

For the groups to be of the required size, their size must be $$k \in \left [\frac{n}{5}, \frac{2n}{5} \right ] \cap \mathbb{N}$$. I could then try checking whether there is an independence set of size $$k$$ (which would mean there are $$k$$ students that potentially like each other), remove its vertices, and repeat for the next $$k$$. However, I don’t think this would result in a polynomial number of size combinations.

Do you have any advice on constructing this reduction?

## How to manage a party that runs better in smaller groups?

I’ve been running a pathfinder campaign for close to 4 years now. In my mind it has been quite successful and my players are generally active and engaged in the story. However, over the course of the campaign I have noticed a strange trend that I’m not sure what to do about. It is kind of strange but I’ll do my best to explain it.

### Group Composition

My player group consists of 4 (sometimes 5) players; my wife, my sister, my best mate and his girlfriend, another friend also plays but is currently overseas for a year. The age range is between 25-32 and the group all get on well. I love this group and want to see this campaign through to the end. Therefore splitting the group is an absolute last resort.

### Campaign Details

I run a large scale open world campaign, with lots of sandbox play and opportunities for the players to explore. There are plots and threats throughout the world but where they go and how they deal with them is entirely up to the players.

Typically the party spend about 50% of it’s time exploring or traveling; 30% in towns, shopping or interacting with NPCs; and 20% in dungeons or on specific quests. I would like to adjust this slightly to reduce the amount of time spent traveling, most of the time is lost to indecision where the party can’t agree on a single course of action. More accurately they like to carefully examine every possible option before deciding, which takes a lot of time to reach a decision.

### The Issue

Throughout the campaign there have been a few times when the party was split up, either for a scene or two, or for an entire session where I ran separate sessions for each half of the party. Most recently they encountered a pit trap that left the party separated in a dungeon. I switched back and forth between the parties until they could rejoin and it went quite well. Previously I’ve had two characters enslaved and forced to fight in an arena while the rest of the party worked on the outside to tilt the odds in their favour. These are just two examples from across a long campaign.

The pattern I have noticed is that almost every time I run one of these sessions the feedback I get is something like “That was the best session ever” or “best session in a while, I got everything done that I wanted to”. Basically the players constantly seem to enjoy sessions where they are separated more than ones where they are not.

Some reason I think this may be happening:

• Faster decision making in smaller groups
• More focused narrative where they always have a role to play in their scenes
• Having less options forces them to think more creatively
• Something to do with how I plan/run these session, though I am unsure what.

### My Question

I’ve struggled with how to formulate this as a question so comments are welcome but here is my current question:

How do I best utilise the knowledge that my players enjoy sessions with smaller groups to improve my game?

Things I have considered:

• Regularly splitting the party – I feel like this is the only solution that can reliably achieve this. But I’m having trouble thinking of ways to split the party often while maintaining a reasonable narrative flow.
• Request for additional feedback – I’ve already tried this somewhat but haven’t gotten much that is meaningful. I can try for more targeted feedback with specific questions.
• Changing the way I prepare my sessions – I think this is my preferred solution but I am struggling to identify what I am doing differently between the split and non-split sessions.

Answer types that I am expecting:

• Advice on how to run for the whole group the way I do for the smaller group
• Suggestions on what the issue with the larger group may be so that I can fix it
• Advice on how to regularly split the party in a logical and narratively maintainable way.
• Something I haven’t thought of (that really the point of this I guess)

### TL;DR

My party seem to enjoy sessions where they are split into smaller groups. How can I use this to improve my game overall?

## Greedy algorithm to divide objects into the lowest number of groups of a maximum size

I have n objects of independent size s, and need to group them so that the sum of the sizes of each group is smaller than a given maximum size, and the number of groups is the smallest possible.

I already tried a brute force algorithm that orders the objects in all possible permutations and then, based on their size and the group max size, divides every permutation in groups based on the order. This algorithm is very slow and therefore I want to find a greedy one, but being new to the topic I can’t think of a good way to start.

My idea would be to start building the first group from the largest object, and then adding more so that every time I add a new one, the difference between the max size and the size of all the objects in the group is minimized. Is this a good starting point?

## Is it correct to use AWS Cognito groups as user roles?

I trying to implement authN/authZ for my application using Spring Security 5.2.2 and OAuth2/openid connect protocols. I use AWS Cognito as an identity provider and I’m trying to implement role-based authorization for my application. I’ve created user groups in the AWS Cognito user pool. In the resource server, when I convert access token, I use this groups (“cognito:groups” claim in the access token) to build granted authorities for spring security. And I manage access in my application based on this groups.

Is this the correct use of AWS Cognito user groups?