| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 0.5 초 | 1024 MB | 10 | 4 | 4 | 66.667% |
Kaloyan was preparing an exam for his students and found the following problem to be pretty interesting. He wrote two numbers $X$ and $Y$ and wants to find a sequence of integers where the sum of every $X$ consecutive elements (in the sequence) is strictly positive while the sum of every $Y$ consecutive elements is strictly negative.
Kaloyan found out that this sequence cannot be infinitely long. He tried to find a sequence of maximum possible length with the described property. However, it turns out to be rather difficult problem for Kaloyan. Help him by writing a program XY that finds the maximum length of such a sequence. You should find the answers to $Q$ such pairs $X$ and $Y$. Additionally, you have to find a maximal sequence only for the first query.
The only line of the standard input contains one number $Q$ - the number of queries. Each of the following $Q$ lines contains two numbers - $X$ and $Y$ .
On the first line of the standard output you should print $Q$ numbers - $N_1, N_2, \dots, N_Q,ドル separated with intervals, where $N_i$ is the answer for the $i^{th}$ query. On the second line you should print $N_1$ integers separated with intervals - a sequence with the desired property for the first query.
| Subtasks | Points | Required subtasks | Other constraints |
|---|---|---|---|
| 1 | 3 | For every query: $x=y$ | |
| 2 | 4 | 1 | For every query: $x$ divides $y$ or $y$ divides $x$ |
| 3 | 9 | $X,Y \leq 5,ドル $Q=1$ | |
| 4 | 12 | $|X-Y| = 1$ | |
| 5 | 15 | 3 | $X,Y,Q \leq 100$ |
| 6 | 22 | 3, 5 | $X,Y,Q \leq 10000$ |
| 7 | 35 | 1, 2, 3, 4, 5, 6 | No additional constraints. |
3 3 5 1 5 4 2
6 4 3 5 -7 5 3 -7 5