| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 1 초 | 512 MB | 29 | 13 | 12 | 54.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.
5 2 4 4 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번