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

20092번 - Cup of Jamshid 점수다국어언어 제한함수 구현

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 512 MB34131152.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()
  • This procedure will be called $T$ times, once for each scenario.
  • In scenario $i$ (for 0ドル \leq i \leq T-1$), the procedure must return an array $c$ of length 2ドル,ドル such that $c[0]=a[i]$ and $c[1]=b[i]$.

To implement the above procedure, you can call the following procedure:

int ask_shahrasb(int x, int y)
  • $x$ and $y$: the coordinates of the selected point. Both coordinates should be integer values in the range $[-10^9,10^9]$.
  • This procedure returns the Katouzian distance between the cup and the point $(x, 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ドル$.
  • Now the location of the cup is uniquely determined, and find_cup() returns $[1,3]$.

입력

출력

제한

  • 1ドル \leq T \leq 1000,ドル
  • $-5 \times 10^8 \leq a[i], b[i] \leq 5 \times 10^8$.

점수

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:

  • line 1ドル$: $\;\;T$
  • line 2ドル + i$ (for 0ドル \le i \le T-1$): $\;\;a[i]\;\;b[i]$

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.

출처

Olympiad > International Olympiad in Informatics > IOI 2017 > Practice 2번

제출할 수 있는 언어

C++17, C++14, C++20, C++14 (Clang), C++17 (Clang), C++20 (Clang)

채점 및 기타 정보

  • 100점 이상을 획득해야 를 받는다.
  • 예제는 채점하지 않는다.
(追記) (追記ここまで)

출처

대학교 대회

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

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