## Equal Sum Solution Round 1A 2022 - Code Jam 2022

### Problem

You are given a set of distinct integers. You need to separate them into two non-empty subsets such that each element belongs to exactly one of them and the sum of all elements of each subset is the same.

An anonymous tip told us that the problem above was unlikely to be solved in polynomial time (or something like that), so we decided to change it. Now you get to decide what half of the integers are!

This is an interactive problem with three phases. In phase 1, you choose distinct integers. In phase 2, you are given another integers that are distinct from each other and from the ones you chose in phase 1. In phase 3, you have to partition those integers into two subsets, both of which sum to the same amount. All integers are to be between and , inclusive, and it is guaranteed that they sum up to an even number.

### Input and output

This is an interactive problem. You should make sure you have read the information in the Interactive Problems section of our FAQ.

Initially, your program should read a single line containing an integer, , the number of test cases. Then, test cases must be processed.

For each test case, your program must first read a line containing a single integer . Then, it must output a line containing distinct integers . Each of these integers must be between and , inclusive. After that, your program must read a line containing additional integers . Finally, your program must output a line containing between and integers from among : the ones chosen to be part of the first subset. The integers from and that you do not output are considered to be part of the other subset.

The next test case starts immediately if there is one. If this was the last test case, the judge will expect no more output and will send no further input to your program. In addition, all test cases are always processed, regardless of whether the final output from your program is correct or not.

If the judge receives an invalidly formatted or invalid line (like outputting an unexpected number of integers, or integers out of range, or repeated integers in a line) from your program at any moment, the judge will print a single number and will not print any further output. If your program continues to wait for the judge after receiving a , your program will time out, resulting in a Time Limit Exceeded error. Notice that it is your responsibility to have your program exit in time to receive a Wrong Answer judgment instead of a Time Limit Exceeded error. As usual, if the memory limit is exceeded, or your program gets a runtime error, you will receive the appropriate judgment.

### Limits

Time limit: 5 seconds.

Memory limit: 1 GB.

#### Test Set 1 (Visible Verdict)

.

.

, for all .

, for all .

, for all .

For each test case, the judge will choose the s such that the sum of all integers is even.

### Testing Tool

You can use this testing tool to test locally or on our platform. To test locally, you will need to run the tool in parallel with your code; you can use our interactive runner for that. For more information, read the instructions in comments in that file, and also check out the Interactive Problems section of the FAQ.

Instructions for the testing tool are included in comments within the tool. We encourage you to add your own test cases. Please be advised that although the testing tool is intended to simulate the judging system, it is NOT the real judging system and might behave differently. If your code passes the testing tool but fails the real judge, please check the Coding section of the FAQ to make sure that you are using the same compiler as us.

2

3

5 1 3

10 4 9

1 10 5

This is correct because .

3

5 2 3

10 8 12

12 8

This is correct because .

**Double or One Thing Solution Round 1A 2022 - Code Jam 2022**

**Join Now for Solution:- **

## No comments:

## Post a Comment