logo AlgoBeat OnlineJudge
登录 注册

#206116. [NEERC 2017] Interactive Sort

内存限制:512 MiB 时间限制:5000 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

这是一道 IO 交互题。


Ivan wants to play a game with you. He took all integers from to inclusive, shuffled them and then put all even numbers into array and all odd numbers into array .

Your task is to find arrays and .

You can ask Ivan questions of certain kind. Each question consists of two integers and . For each question Ivan says whether or not.

You can ask at most questions.

Interaction Protocol

First, the testing system writes the integer -- the number of integers Ivan used.

Your solution shall print requests of two types:

• “? i j”. . The testing system responds with the symbol if or with the symbol otherwise.

• “!\ ” tells the values of and that your program has determined.

Don't forget to flush the output after each request!

Your solution must issue exactly one request of the second type, which must be the last request, and thesolution must terminate gracefully after issuing it.

Your solution is allowed to issue at most requests of the first type.

For each test case the number is fixed and the numbers are shuffled using Java built-in shuffle functionwith fixed seed.

样例

样例输入 1

5
>
>
<
>
<
<

样例输出 1

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