Logo
(追記) (追記ここまで)

22379번 - Feed candies 스페셜 저지다국어채점 준비 중

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 512 MB0000.000%

문제

You are playing a game to bring a slime up. The slime has two integral parameters called softness and transparency. In this game, there are 10ドル^{100}$ types of candies numbered from 1ドル$ to 10ドル^{100},ドル and if you feed the $i$-th type of candy to the slime, its softness and transparency increase by $s_i$ and $t_i,ドル respectively. Here, you know that $s_i$ and $t_i$ are calculated by the following formulae where $A$ and $B$ are integers.

  • $(s_1, t_1) = (1, 0)$
  • $(s_i, t_i) = (As_{i-1} - Bt_{i-1}, Bs_{i-1} + At_{i-1})$ for each 2ドル \le i \le 10^{100}$

In addition, the slime likes eating new types of candies. Therefore, you can feed each type of candy at most once.

Initially, the slime's softness and transparency are both zero. Your objective is to feed zero or more types of candies to the slime so that the slime's softness and transparency become $X$ and $Y,ドル respectively. Determine whether this is possible, and if it is possible, find such a way.

In the first sample input, the characteristics of the first four types of candies are as follows.

  • $(s_1, t_1) = (1, 0)$
  • $(s_2, t_2) = (2, -1)$
  • $(s_3, t_3) = (3, -4)$
  • $(s_4, t_4) = (2, -11)$

If you feed the first, second and fourth types of candies to the slime, the slime's softness and transparency become 1ドル + 2 + 2 = 5$ and 0ドル + (-1) + (-11) = -12,ドル respectively.

입력

The input consists of multiple datasets. Each dataset is represented in the following format.

$A$ $B$ $X$ $Y$

Each dataset consists of a single line which contains four integers $A,ドル $B,ドル $X$ and $Y$. You may assume that $-100 \le A \le 100,ドル $-100 \le B \le 100,ドル $-10^{16} \le X \le 10^{16},ドル $-10^{16} \le Y \le 10^{16}$ and $|A| + |B| \ge 2$.

The end of the input is represented by a line consisting of four zeros. The number of datasets should not exceed 200.

출력

For each dataset, if your objective is unachievable, print $-1$ in a single line. Otherwise, let $m$ be the number of types of candies you feed to the slime. Print $m$ on the first line. Then, for each 1ドル \le k \le m,ドル on the ($k+1$)-st line print the $k$-th smallest type of candy you feed to the slime.

If there are multiple correct answers, print any of them.

제한

예제 입력 1

2 -1 5 -12
2 0 33 0
-10 0 123 0
-4 7 143800796 -5765753
0 0 0 0

예제 출력 1

3
1
2
4
2
1
6
-1
1
10

힌트

출처

Contest > ICPC Japanese Alumni Group > JAG Practice Contest for ICPC Asia Regional > JAG Practice Contest for ICPC 2020 Asia Yokohama Regional 2020 K번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /