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

33291번 - Spoiler 스페셜 저지다국어

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

문제

For a positive integer $k$ and a positive integer $f_1,ドル a sequence $f$ is recursively generated according to the following formula for $n \geq 2$: $$f_n = k n + \left \lceil \frac{f_{n-1}}{n} \right \rceil \cdot n$$

For example, if $k = 4$ and $f_1 = 23$:

$$\begin{array}{lllrrrr} f_1 & & & & & = & 23 \\ f_2 & = & 4 \cdot 2 & + & 24 & = & 32 \\ f_3 & = & 4 \cdot 3 & + & 33 & = & 45 \\ f_4 & = & 4 \cdot 4 & + & 48 & = & 64 \\ f_5 & = & 4 \cdot 5 & + & 65 & = & 85 \\ f_6 & = & 4 \cdot 6 & + & 90 & = & 114 \\ f_7 & = & 4 \cdot 7 & + & 119 & = & 147 \\ \end{array} $$

For such a sequence, an index $m \geq 2$ is called the starting index of interpolation if there exists a polynomial $P(n)$ such that $P(n) = f_n$ for every $n \geq m,ドル but $P(m-1) \neq f_{m-1}$. In the example above, 5ドル$ is the starting index of interpolation: for every index greater than 4ドル,ドル $f_n = P(n) = 2 n^2 + 7 n,ドル but $f_4 = 64 \neq P(4) = 60$.

You are given an integer $x$. Find any pair of parameters $f_1$ and $k$ and an index $m$ satisfying the following conditions, or report there are none:

  • 1ドル \leq f_1 \leq 10^{10},ドル 1ドル \leq k \leq 10^5,ドル 2ドル \leq m \leq 10^{18}$;
  • $m$ is the starting index of interpolation for the sequence generated with these parameters;
  • $f_m = x$.

The condition with inequalities is important. In particular, if, for some input, the only triplets $(f_1, k, m)$ which satisfy the last two conditions don't meet the first one, then you should report there is no solution.

입력

Each test contains one or more test cases. The first line contains the number of test cases $t$ (1ドル \le t \le 100$).

The only line of each test case contains an integer $x$ (2ドル \le x \le 10^{18})$. There is at most one test case with \(x > 10^9\).

출력

For each test case, if there is no answer, print -1.

Otherwise, output a line with three integers: $f_1,ドル $k,ドル $m$ (1ドル \leq f_1 \leq 10^{10},ドル 1ドル \leq k \leq 10^5,ドル 2ドル \leq m \leq 10^{18}$). If there are multiple solutions, print any one of them.

제한

예제 입력 1

4
85
7
6
637275712755506

예제 출력 1

23 4 5
-1
1 2 2
-1

노트

Warning! For the third test case, "2 2 2" is not a right answer because in that case $P(1) = f_1,ドル thus 2ドル$ is not the starting index of interpolation.

출처

Camp > Petrozavodsk Programming Camp > Summer 2024 > Day 4: Danil Zashikhin && Atilla Gün Contest, supported by Pinely K번

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

출처

대학교 대회

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

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