CSES Problemset/Introductory Problems
Two Sets
#1092Ask AI
Open a hint-first prompt in a new AI chat. Grok may ask you to confirm before sending.
Open Claude DesktopYour task is to divide the numbers into two sets of equal sum.
Input
The only input line contains an integer .
Output
Print "YES", if the division is possible, and "NO" otherwise.
After this, if the division is possible, print an example of how to create the sets. First, print the number of elements in the first set followed by the elements themselves in a separate line, and then, print the second set in a similar way.
Constraints
Sample Test Cases (2)
Example 1ID: sample-1
Input
7
Expected Output
YES 4 1 2 4 7 3 3 5 6
Example 2ID: sample-2
Input
6
Expected Output
NO
Tools
1
2
3
4
5
6
7
8
9
10
11
12
Draft saved locally
|1 line, 0 charsTest Bench
Input (stdin)
7
Expected Output
YES 4 1 2 4 7 3 3 5 6