CF1733B.Rule of League
普及/提高-
通过率:0%
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
There is a badminton championship in which n players take part. The players are numbered from 1 to n .
The championship proceeds as follows: player 1 and player 2 play a game, then the winner and player 3 play a game, and then the winner and player 4 play a game, and so on. So, n−1 games are played, and the winner of the last game becomes the champion. There are no draws in the games.
You want to find out the result of championship. Currently, you only know the following information:
- Each player has either won x games or y games in the championship.
Given n , x , and y , find out if there is a result that matches this information.
输入格式
The first line contains one integer t ( 1≤t≤105 ) — the number of test cases.
The only line of each test case contains three integers n , x , y ( 2≤n≤105 , 0≤x,y<n ).
It is guaranteed that the sum of n over all test cases doesn't exceed 2⋅105 .
输出格式
Print the answer for each test case, one per line. If there is no result that matches the given information about n , x , y , print −1 . Otherwise, print n−1 space separated integers, where the i -th integer is the player number of the winner of the i -th game.
If there are multiple valid results, print any.
输入输出样例
输入#1
5 5 2 0 8 1 2 3 0 0 2 0 1 6 3 0
输出#1
1 1 4 4 -1 -1 2 -1
说明/提示
In the first test case, player 1 and player 4 won x times, player 2 and player 3 won y times.
In the second, third, and fifth test cases, no valid result exists.