Account
GitHubFeedback
Drafts and results saved on this device
Submit on CSES.fi
CSES Problemset/Introductory Problems

Raab Game I

#3399
Ask AI

Open a hint-first prompt in a new AI chat. Grok may ask you to confirm before sending.

Open Claude Desktop

Time limit:1.00 s
Memory limit:512 MB
Unsolved
Download Tests (.zip)

Consider a two player game where each player has nn cards numbered 1,2,…,n1,2,\dots,n. On each turn both players place one of their cards on the table. The player who placed the higher card gets one point. If the cards are equal, neither player gets a point. The game continues until all cards have been played.

You are given the number of cards nn and the players' scores at the end of the game, aa and bb. Your task is to give an example of how the game could have played out.

Input

The first line contains one integer tt: the number of tests.

Then there are tt lines, each with three integers nn, aa and bb.

Output

For each test case print YES if there is a game with the given outcome and NO otherwise.

If the answer is YES, print an example of one possible game. Print two lines representing the order in which the players place their cards. You can give any valid example.

Constraints
  • 1≤t≤10001 \le t \le 1000
  • 1≤n≤1001 \le n \le 100
  • 0≤a,b≤n0 \le a,b \le n
Sample Test Cases (1)
Example 1ID: sample-1
Input
5
4 1 2
2 0 1
3 0 0
2 1 1
4 4 1
Expected Output
YES
1 4 3 2
2 1 3 4
NO
YES
1 2 3
1 2 3
YES
1 2
2 1
NO
Tools
1
2
3
4
5
6
7
8
9
10
11
12
Draft saved locally
|1 line, 0 chars
Test Bench
Download .zip
Input (stdin)
5
4 1 2
2 0 1
3 0 0
2 1 1
4 4 1
Expected Output
YES
1 4 3 2
2 1 3 4
NO
YES
1 2 3
1 2 3
YES
1 2
2 1
NO