| Final round of the X Vologda Regional Informatics Olympiad for the Governors Prize 2025, grades 9-10 |
|---|
| Finished |
You are given $$$4 \cdot k$$$ weights with masses of 1 gram, 2 grams, ..., $$$4 \cdot k$$$ grams. They are divided into two equal parts in terms of both quantity and mass. Remove two weights from each group so that the masses of the groups remain equal.
The first line of the input contains an integer $$$k$$$ ($$$1 \le k \le 50000$$$). The second line contains $$$2 \cdot k$$$ integers separated by spaces, which are the masses of the weights in the first group. The third line contains $$$2 \cdot k$$$ integers, which are the masses of the weights in the second group. The sums of the numbers in the groups are equal. Each number from 1 to $$$4 \cdot k$$$ appears exactly once.
Output four integers in any order – the masses of the weights that need to be removed. If there are multiple correct answers, output any.
Subtask 1 (up to 40 points): $$$k \le 20$$$
Subtask 2 (up to 28 points): $$$k \le 200$$$
Subtask 3 (up to 32 points): $$$k \le 50000$$$
2 2 5 3 8 7 1 6 4
3 2 4 1
Note for Python users: to input a set of numbers separated by spaces, you can do it like this:
a = [int(x) for x in input().split()]
| Name |
|---|


