시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
3 초 | 1024 MB | 114 | 29 | 24 | 25.806% |
This problem is interactive. Refer to the Interaction section below for a better understanding.
Today was the first class of CS999.
First, you have learned non-negative integer less than or equal to $4 \times 10^{18}$.
You have also learned the addition, subtraction, and comparison of two integers.
The homework is to compare two fractions $\frac{A}{B}$ and $\frac{C}{D}$. Professor told you that you can solve homework only using classroom materials.
You are only allowed to use the following operations:
By using these operations, you have to compare two fractions.
This subtask has an additional constraint:
Your program should satisfy:
This subtask has an additional constraint:
Your program should satisfy:
This subtask has an additional constraint:
Your program should satisfy:
This subtask has no additional constraint.
Your program should satisfy:
This subtask has no additional constraint.
Your program should satisfy:
This subtask has no additional constraint.
-1
+ 5 3 1 - 1 2 1 < 1 5 ! 0
For the first example, $A=1$, $B=1$, $C=2$, $D=2$. It satisfies the constraint of subtask 2,3,4,5,6.
1 -1 0
< 1 2 < 4 3 < 2 2 ! -1
For the second example, $A=1$, $B=2$, $C=3$, $D=4$. It satisfies the constraint of every subtask.
You cannot get $A$, $B$, $C$, nor $D$ directly in this problem.
Instead, you can use some operations to a hidden array of length $10^6$; $X_1, X_2, \cdots, X_{10^6}$.
Initially, $X$ satisfies $X_1=A$, $X_2=B$, $X_3=C$, $X_4=D$, and $X_i=0$ for $i$ greater than $4$.
You can use the following commands to do operations:
+ i j k
" ($1 \le i, j, k \le 10^6$). $X_i$ will be replaced with a value of $X_j+X_k$.Wrong Answer
". Nothing will be given to the input.- i j k
" ($1 \le i, j, k \le 10^6$). $X_i$ will be replaced with a value of $X_j-X_k$.Wrong Answer
". Nothing will be given to the input.< i j
" ($1 \le i, j \le 10^6$). A line containing one integer will be given to the input.
-1
" will be given when $X_i<X_j$.0
" will be given when $X_i=X_j$.1
" will be given when $X_i>X_j$.After successfully comparing $\frac{A}{B}$ and $\frac{C}{D}$,
! -1
".! 0
".! 1
".If you ask more than $200\,001$ commands or make an invalid query, the interactor will terminate immediately and your program will receive the verdict "Wrong Answer
".
If your comparison is incorrect, your score will be $0$.
Otherwise, the score of the program will be graded with three factors: