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

19822번 - How to Learn You Score 다국어인터랙티브

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 512 MB29131254.545%

문제

Petya participates in such contest that the participants only learn results of judging their submissions after the end of the contest.

There are $n$ problems numbered from 1ドル$ to $n$ in the contest. For each problem he has made a submission. After the contest he was very eager to learn his points and his place. But the results would only be published at the closing ceremony, which is a few hours away.

Petya decided to find out his result before that: to get his points for each problem from the jury, he would ask weird questions. Let Petya's points be $c_1, c_2, \ldots, c_n$ for problems 1,ドル 2, \ldots, n,ドル respectively. Petya doesn't know these numbers and wants to find them out.

Petya chooses three distinct numbers of the problems and asks the jury to tell him the sum of the minimum and the maximum points he received for these three problems. Fortunately, the jury answers such queries. Formally, if he queries about $i,ドル $j,ドル $k,ドル he gets $min(c_i, c_j, c_k) + max(c_i, c_j, c_k)$.

Petya still doesn't know how to find out all his points. Help him find out $c_1, c_2, \ldots, c_n,ドル by making no more than 4ドルn$ queries to the jury.

입력

출력

제한

프로토콜

First, your program must read a single integer $n$ --- the number of the problems in the contest (5ドル \leq n \leq 1000$).

Next, your program can make queries about the sum of minimum and maximum points among problems $i,ドル $j,ドル $k$. In order to do that, output a separate line <<? $i$ $j$ $k$>> (1ドル \leq i, j, k \leq n,ドル $i \neq j,ドル $j \neq k,ドル $i \neq k$). As the answer to this query, you will get a single integer $min(c_i, c_j, c_k) + max(c_i, c_j, c_k)$ in the input.

If your program makes more than 4ドルn$ queries or asks an invalid query, you get <<Wrong Answer>>.

After finding Petya's points output <<! $c_1$ $c_2$ $\ldots$ $c_n$>> --- the points for each problem.

It is guaranteed that Petya's points for each problem satisfy 0ドル \leq c_i \leq 10^9$ for all 1ドル \leq i \leq n$. Also, all numbers $c_i$ are fixed in advance and won't change during the testing of your program.

예제 입력 1

5
2
4
4
1

예제 출력 1

? 1 2 3
? 1 3 5
? 5 4 3
? 1 4 2
! 1 0 2 1 3

힌트

In this sample, there are 5ドル$ problems, and Petya got 1ドル,ドル 0ドル,ドル 2ドル,ドル 1ドル,ドル 3ドル$ points for the problems. If he queries about problems 1ドル,ドル 2ドル,ドル 3ドル,ドル his minimum points among them is 0ドル$ (for the 2ドル$-nd problem), and his maximum is 2ドル$ (for the 3ドル$-rd problem). Thus, the jury will answer 2ドル = 0 + 2$ to that query.

출처

Olympiad > Russian Olympiad in Informatics > Russia Team High School Programming Contest > Russia Team High School Programming Contest 2018 F번

채점 및 기타 정보

  • 예제는 채점하지 않는다.
(追記) (追記ここまで)

출처

대학교 대회

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

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