CF1466I.The Riddle of the Sphinx

NOI/NOI+/CTSC

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

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

题目描述

What walks on four feet in the morning, two in the afternoon, and three at night?

This is an interactive problem. This problem doesn't support hacks.

Sphinx's duty is to guard the city of Thebes by making sure that no unworthy traveler crosses its gates. Only the ones who answer her riddle timely and correctly (or get an acc for short) are allowed to pass. As of those who fail, no one heard of them ever again...

So you don't have a choice but to solve the riddle. Sphinx has an array a1,a2,…,ana_1, a_2, \ldots, a_n of nonnegative integers strictly smaller than 2b2^b and asked you to find the maximum value among its elements. Of course, she will not show you the array, but she will give you nn and bb. As it is impossible to answer this riddle blindly, you can ask her some questions. For given i,yi, y, she'll answer you whether aia_i is bigger than yy. As sphinxes are not very patient, you can ask at most $3 \cdot (n + b) $ such questions.

Although cunning, sphinxes are honest. Even though the array can change between your queries, answers to the previously asked questions will remain valid.

什么东西早上用四只脚走路,中午用两只脚走路,晚上用三只脚走路?

这是一个交互式问题。本题不支持 Hack。

斯芬克斯的职责是守卫底比斯城,确保没有不配的旅人穿过它的城门。只有那些及时且正确地回答出她谜题(简称“AC”)的人,才被允许通过。至于那些失败者,再无人听说过他们的下落……

因此,你别无选择,只能解开这个谜题。斯芬克斯拥有一个长度为 nn 的非负整数数组 a1,a2,…,ana_1, a_2, \ldots, a_n,其中每个元素严格小于 2b2^b,她要求你找出该数组中元素的最大值。当然,她不会直接向你展示这个数组,但会告诉你 nn 和 bb 的值。由于盲目作答是不可能的,你可以向她提出若干问题:对于给定的 ii 和 yy,她会回答 aia_i 是否大于 yy。然而,斯芬克斯缺乏耐心,你最多只能提出 3⋅(n+b)3 \cdot (n + b) 个这样的问题。

尽管狡黠,斯芬克斯却诚实守信。即使在你提问过程中该数组可能发生变化,此前所有已提出问题的答案仍将保持有效。

输入格式

The first line contains two integers nn and bb (1≤n,b≤2001 \leq n, b \leq 200). The remaining parts of the input will be given throughout the interaction process.

第一行包含两个整数 nn 和 bb(1≤n,b≤2001 \leq n, b \leq 200)。输入的其余部分将在交互过程中给出。

输入输出样例

  • 输入#1

    5 3
    
    yes
    
    no
    
    no
    
    no
    
    no
    
    yes

    输出#1

    5 101
    
    5 110
    
    4 100
    
    3 101
    
    2 001
    
    1 000
    
    0 110
  • 输入#2

    4 3
    
    no
    
    no
    
    no
    
    no

    输出#2

    1 000
    
    2 000
    
    3 000
    
    4 000
    
    0 000
  • 输入#3

    1 1

    输出#3

    0 0

说明/提示

In all examples, the sequence is fixed beforehand.

In the first example, the sequence is 2,1,4,0,62, 1, 4, 0, 6.

In the second example, the sequence is 0,0,0,00, 0, 0, 0.

In the third example, the sequence is 00.

Note that if the interactor was adaptive, then the interaction in the first and the third example would not be sufficient to return the correct value of maximum.

在所有示例中,序列均预先固定。

在第一个示例中,序列为 2,1,4,0,62, 1, 4, 0, 6。

在第二个示例中,序列为 0,0,0,00, 0, 0, 0。

在第三个示例中,序列为 00。

注意:若交互器是自适应的,则第一个和第三个示例中的交互不足以返回正确的最大值。

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

首页