CF1746E1.Joking (Easy Version)

省选/NOI-

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

The only difference between this problem and the hard version is the maximum number of questions.

This is an interactive problem.

There is a hidden integer 1≤x≤n1 \le x \le n which you have to find. In order to find it you can ask at most 82\mathbf{82} questions.

In each question you can choose a non-empty integer set SS and ask if xx belongs to SS or not, after each question, if xx belongs to SS, you'll receive "YES", otherwise "NO".

But the problem is that not all answers are necessarily true (some of them are joking), it's just guaranteed that for each two consecutive questions, at least one of them is answered correctly.

Additionally to the questions, you can make at most 22 guesses for the answer xx. Each time you make a guess, if you guess xx correctly, you receive ":)" and your program should terminate, otherwise you'll receive ":(".

As a part of the joking, we will not fix the value of xx in the beginning. Instead, it can change throughout the interaction as long as all the previous responses are valid as described above.

Note that your answer guesses are always answered correctly. If you ask a question before and after a guess, at least one of these two questions is answered correctly, as normal.

本题与困难版本的唯一区别在于最大提问次数。

这是一道交互式题目。

存在一个隐藏的整数 1≤x≤n1 \le x \le n,你需要找出它。你最多可以提出 82\mathbf{82} 个问题。

在每个问题中,你可以选择一个非空整数集合 SS,并询问 xx 是否属于 SS;每次提问后,若 x∈Sx \in S,你将收到 "YES",否则收到 "NO"。

但问题在于,并非所有回答都一定为真(其中一些回答是“开玩笑”的),仅保证:对任意两个连续提出的问题,至少有一个的回答是正确的。

此外,你最多可进行 22 次对答案 xx 的猜测。每次猜测时,若你猜中了 xx,你将收到 ":)",此时你的程序应立即终止;否则你将收到 ":("。

作为“开玩笑”的一部分,我们不会在交互开始时就固定 xx 的值;相反,xx 可以在整个交互过程中动态变化,只要所有此前给出的回答仍满足上述约束即可(即:对任意两个连续问题,至少一个回答正确)。

注意:你所作的猜测总是被正确回答的。如果你在一次猜测前后各提了一个问题,则这两个问题中至少有一个的回答是正确的(与前述规则一致)。

输入格式

The only line of the input contains a single integer nn (1≤n≤1051 \le n \le 10^5), the maximum possible value of xx.

输入仅包含一行,其中有一个整数 nn(1≤n≤1051 \le n \le 10^5),表示 xx 的最大可能值。

输入输出样例

  • 输入#1

    6
    
    NO
    
    :(
    
    NO
    
    :)

    输出#1

    ? 5 1 2 5 4 3
    
    ! 6
    
    ? 4 1 2 3 4
    
    ! 5

说明/提示

If the answer of the first question were correct, then xx would have been equal to 66, but as we can see in the first guess, 66 is not the answer.

So the answer of the first question is joking. As we know, the answer of at least one of our two questions is correct, since the answer of the first question was joking, the answer of the second question should be correct.

So we will understand that xx is not equal to 1,2,31, 2, 3 or 44, and we also knew that xx is not equal to 66 either. Hence xx should be equal to 55.

如果第一个问题的答案是正确的,那么 xx 就应等于 66,但正如我们在第一次猜测中所见,66 并非答案。

因此,第一个问题的答案是在开玩笑。我们知道,我们提出的两个问题中,至少有一个的答案是正确的;既然第一个问题的答案是在开玩笑,那么第二个问题的答案就应该是正确的。

因此我们可以得出:xx 不等于 1,2,31, 2, 3 或 44;同时我们还知道 xx 也不等于 66。故 xx 应等于 55。

输入解题思路,AI测评打分。不知道怎么写?

首页