CF1918E.ace5 and Task Order

提高+/省选-

通过率:0%

时间限制:2.00s

内存限制:256MB

AC君温馨提醒

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

题目描述

This is an interactive problem!

In the new round, there were nn tasks with difficulties from 11 to nn. The coordinator, who decided to have the first round with tasks in unsorted order of difficulty, rearranged the tasks, resulting in a permutation of difficulties from 11 to nn. After that, the coordinator challenged ace5 to guess the permutation in the following way.

Initially, the coordinator chooses a number xx from 11 to nn.

ace5 can make queries of the form: ? i?\ i. The answer will be:

  • $ \gt $, if ai>xa_i \gt x, after which xx increases by 11.
  • $ \lt $, if ai<xa_i \lt x, after which xx decreases by 11.
  • ==, if ai=xa_i = x, after which xx remains unchanged.

The task for ace5 is to guess the permutation in no more than 40n40n queries. Since ace5 is too busy writing the announcement, he has entrusted this task to you.

这是一个交互式问题!

在新一轮比赛中,共有 nn 道题目,难度分别为 11 到 nn。出题人决定让第一轮的题目按难度非升序/非降序排列,于是将题目重新排序,得到一个 11 到 nn 的排列(即难度的一个排列)。之后,出题人向 ace5 提出挑战:让他猜出该排列,规则如下。

初始时,出题人选定一个数 xx,其取值范围为 11 到 nn。

ace5 可以进行形如 ? i?\ i 的查询。系统将返回以下三种回答之一:

  • $ \gt $,若 ai>xa_i \gt x;此后 xx 增加 11;
  • $ \lt $,若 ai<xa_i \lt x;此后 xx 减少 11;
  • ==,若 ai=xa_i = x;此后 xx 保持不变。

ace5 的任务是在不超过 40n40n 次查询内猜出整个排列 aa。由于 ace5 正忙于撰写比赛公告,他已将此任务托付给你。

输入格式

The first line contains a single integer tt (1≤t≤10001 \leq t \leq 1000) — the number of test cases.

第一行包含一个整数 tt(1≤t≤10001 \leq t \leq 1000)——测试用例的数量。

输入输出样例

  • 输入#1

    2
    5
    
    &gt;
    
    =
    
    &lt;
    
    =
    
    &lt;
    
    &lt;
    
    2
    
    &gt;

    输出#1

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

说明/提示

In the first test, the hidden permutation is aa = [2,4,1,5,32,4,1,5,3], and the initial value of xx is 33.

In the second test, the hidden permutation is aa = [2,12,1], and the initial value of xx is 11.

在第一次测试中,隐藏的排列为 aa = [2,4,1,5,32,4,1,5,3],且 xx 的初始值为 33。

在第二次测试中,隐藏的排列为 aa = [2,12,1],且 xx 的初始值为 11。

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

首页