← 返回题目列表

Codeforces · 1090/F

F. 如何了解你的分数

中文机器翻译题面 查看原题

以下页面来自赛事官方发布的原题PDF,已完整保存并渲染到本地。

How to Learn You Score - 原题 PDF 第 1 页
原题PDF第8页
可复制的 PDF 提取文本
XIX Russia Team Open, High School Programming Contest
              St Petersburg, Barnaul, Tbilisi, Almaty, Kremenchug, Sochi, December 9, 2018
Problem F. How to Learn You Score

    Time limit:        1 second
    Memory limit:     512 megabytes

This is an interactive problem.

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 c1, c2, . . . , cn for problems 1, 2, . . . , 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(ci, cj, ck) + max(ci, cj, ck).

Petya still doesn’t know how to find out all his points. Help him find out c1, c2, . . . , cn, by making no more
than 4n queries to the jury.

Interaction Protocol

First,  your  program  must  read  a  single  integer n —  the  number  of  the  problems  in  the
contest (5 ≤n ≤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 ≤i, j, k ≤n, i ̸= j, j ̸= k, i ̸= k). As the
answer to this query, you will get a single integer min(ci, cj, ck) + max(ci, cj, ck) in the input.

If your program makes more than 4n queries or asks an invalid query, you get «Wrong Answer».

After finding Petya’s points output «! c1 c2  . . . cn» — the points for each problem.
It is guaranteed that Petya’s points for each problem are integer and satisfy 0 ≤ci ≤109 for all 1 ≤i ≤n.
Also, all numbers ci are fixed in advance and won’t change during the testing of your program.

Example

             standard input                         standard output
 5                                       ? 1 2 3
 2                                       ? 1 3 5
 4                                       ? 5 4 3
 4                                       ? 1 4 2
 1                                       ! 1 0 2 1 3

Note

Print new line character after each line. After each action your program must flush standard output. If
you use “writeln” in Pascal, “cout << ... << endl” in C++, “System.out.println” in Java, “print”
in Python, “Console.WriteLine” in C#, standard output is automatically flushed, no additional action
is required. If you are using other way to output data, you should flush standard output. Note that even
if you flush output, you absolutely must print new line character.

Explanation

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.


                                         Page 8 of 18