| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 1 초 | 512 MB | 34 | 13 | 11 | 52.381% |
Jamshid, a great king of ancient Persia, is looking for the cup of divination, a miraculous cup through which one could observe all over the universe. He has asked Shahrasb, a great wizard who lives in Alborz mountains, for his help.
Shahrasb told Jamshid that the cup is hidden somewhere in the Great Salt Desert, a large desert in the middle of ancient Persia, but he doesn't know its exact location. Furthermore, Jamshid can ask him several questions. In each question, Jamshid selects a point anywhere in Persia (inside or outside of the desert), and Shahrasb can use his magical powers to find the Katouzian distance between the cup and the selected point.
Each point in Persia has integer $x$ and $y$ coordinates in the range $[-10^9, 10^9]$. The desert is a square region in the center, with $x$ and $y$ coordinates in the range $[-5 \times 10^8, 5 \times 10^8]$. The Katouzian distance between two points $(x, y)$ and $(p, q)$ is calculated as $|x - p| \oplus |y - q|,ドル where $|x - p|$ is the absolute value of $(x-p),ドル and $\oplus$ indicates bitwise XOR (exclusive OR).
Your task is to help Jamshid find the cup by asking Shahrasb a number of questions.
There are $T$ different scenarios, numbered 0ドル$ through $T-1$. The coordinates of the cup in scenario $i$ (for 0ドル \leq i \leq T-1$) is $(a[i], b[i])$. You should implement the following procedure:
int[] find_cup()
To implement the above procedure, you can call the following procedure:
int ask_shahrasb(int x, int y)
Consider find_cup() is called, and the cup is hidden at the point $(1,3)$. The implementation of find_cup() makes the following procedure calls:
ask_shahrasb(4, 1) returns 1ドル$.ask_shahrasb(0, 2) returns 0ドル$.ask_shahrasb(-1, 0) returns 1ドル$.find_cup() returns $[1,3]$.Your score will be 0ドル$ if the return value of find_cup() is incorrect for any of the scenarios. Otherwise, your score will be computed as below ($Q$ is the maximum number of questions asked among all scenarios).
| Condition | Score |
|---|---|
| 1000ドル < Q $ | 0ドル$ |
| 104ドル < Q \leq 1000$ | 20ドル$ |
| 70ドル < Q \leq 104$ | 30ドル$ |
| 39ドル < Q \leq 70$ | 61ドル$ |
| 32ドル < Q \leq 39$ | 132ドル-Q$ |
| $Q \leq 32$ | 100ドル$ |
The sample grader reads the input in the following format:
For each scenario, the sample grader prints a single integer in a separate line: the number of calls to ask_shahrasb() in the scenario, or $-1$ if the return value of find_cup() was incorrect.
C++17, C++14, C++20, C++14 (Clang), C++17 (Clang), C++20 (Clang)