#C1466. Team Partitioning Challenge

    ID: 44333 Type: Default 1000ms 256MiB

Team Partitioning Challenge

Team Partitioning Challenge

You are given a list of integers representing the skill levels of players. Your task is to divide these players into two teams such that the absolute difference between the total skill levels of the two teams is minimized.

Formally, given a set (S) with skill values, you need to partition it into two subsets (A) and (B) so that the expression ( \left| \sum_{a \in A}a - \sum_{b \in B}b \right| ) is as small as possible.

inputFormat

The input is given via standard input (stdin).

The first line contains an integer (n), the number of players. The second line contains (n) space-separated integers representing the skill levels of the players.

outputFormat

Output the minimum possible absolute difference between the total skills of the two teams via standard output (stdout).## sample

4
4 5 6 7
0

</p>