This is an interactive problem. Remember to flush your output while communicating with the testing program. You may use fflush(stdout) in C++, system.out.flush() in Java, stdout.flush() in Python or flush(output) in Pascal to flush the output. If you use some other programming language, consult its documentation. You may also refer to the guide on interactive problems: https://codeforces.com/blog/entry/45307.

The jury guessed some array aa consisting of 66 integers. There are 66 special numbers — 44, 88, 1515, 1616, 2323, 4242 — and each of these numbers occurs in aa exactly once (so, aa is some permutation of these numbers).

You don't know anything about their order, but you are allowed to ask up to 44 queries. In each query, you may choose two indices ii and jj (1≤i,j≤61≤i,j≤6, ii and jj are not necessarily distinct), and you will get the value of ai⋅ajai⋅aj in return.

Can you guess the array aa?

The array aa is fixed beforehand in each test, the interaction program doesn't try to adapt to your queries.

Interaction

Before submitting the answer, you may ask up to 44 queries. To ask a query, print one line in the following format: ?? ii jj, where ii and jjshould be two integers such that 1≤i,j≤61≤i,j≤6. The line should be ended with a line break character. After submitting a query, flush the output and read the answer to your query — one line containing one integer ai⋅ajai⋅aj. If you submit an incorrect query (or ask more than 44queries), the answer to it will be one string 0. After receiving such an answer, your program should terminate immediately — otherwise you may receive verdict "Runtime error", "Time limit exceeded" or some other verdict instead of "Wrong answer".

To give the answer, your program should print one line !! a1a1 a2a2 a3a3 a4a4 a5a5 a6a6 with a line break in the end. After that, it should flush the output and terminate gracefully.

Example
input

Copy
16
64
345
672
output

Copy
? 1 1
? 2 2
? 3 5
? 4 6
! 4 8 15 16 23 42
Note

If you want to submit a hack for this problem, your test should contain exactly six space-separated integers a1a1, a2a2, ..., a6a6. Each of 66 special numbers should occur exactly once in the test. The test should be ended with a line break character.

鸣谢https://blog.csdn.net/b_r_e_a_d/article/details/81784223

代码

#include <cstdio>
#include <cstring>
#include<cmath>
#include<algorithm>
#include<iostream>
using namespace std;
int a[]={,,,,,},d[];
int main() {
for(int i=;i<=;i++)
{
printf("? %d %d\n",i,i+);
fflush(stdout);
cin>>d[i];
}
do
{
if(a[]*a[]==d[]&&a[]*a[]==d[]&&a[]*a[]==d[]&&a[]*a[]==d[])
break;
}while(next_permutation(a,a+));
printf("!"); for(int i=;i<;i++)
cout<<" "<<a[i]; fflush(stdout);
return ;
}

Educational Codeforces Round 65 (Rated for Div. 2)B. Lost Numbers(交互)的更多相关文章

  1. Educational Codeforces Round 65 (Rated for Div. 2) B. Lost Numbers

    链接:https://codeforces.com/contest/1167/problem/B 题意: This is an interactive problem. Remember to flu ...

  2. Educational Codeforces Round 65 (Rated for Div. 2)(ACD)B是交互题,不怎么会

    A. Telephone Number A telephone number is a sequence of exactly 11 digits, where the first digit is  ...

  3. Educational Codeforces Round 65 (Rated for Div. 2)题解

    Educational Codeforces Round 65 (Rated for Div. 2)题解 题目链接 A. Telephone Number 水题,代码如下: Code #include ...

  4. Educational Codeforces Round 65 (Rated for Div. 2) D. Bicolored RBS

    链接:https://codeforces.com/contest/1167/problem/D 题意: A string is called bracket sequence if it does ...

  5. Educational Codeforces Round 65 (Rated for Div. 2) C. News Distribution

    链接:https://codeforces.com/contest/1167/problem/C 题意: In some social network, there are nn users comm ...

  6. Educational Codeforces Round 65 (Rated for Div. 2) A. Telephone Number

    链接:https://codeforces.com/contest/1167/problem/A 题意: A telephone number is a sequence of exactly 11  ...

  7. [ Educational Codeforces Round 65 (Rated for Div. 2)][二分]

    https://codeforc.es/contest/1167/problem/E E. Range Deleting time limit per test 2 seconds memory li ...

  8. Educational Codeforces Round 65 (Rated for Div. 2)

    A:签到. #include<bits/stdc++.h> using namespace std; #define ll long long #define inf 1000000010 ...

  9. Educational Codeforces Round 65 (Rated for Div. 2) E. Range Deleting(思维+coding)

    传送门 参考资料: [1]:https://blog.csdn.net/weixin_43262291/article/details/90271693 题意: 给你一个包含 n 个数的序列 a,并且 ...

随机推荐

  1. python函数定义中引用外部变量的一个问题

    如果在函数定义的默认值中引用了一个外部变量,如下所示 x = 3 def func(a = x): print(a, x) 那么a的默认值就会是3, 但是print语句中的x会是调用时的x值 lamb ...

  2. 会话技术中的Cookie与session

    关于会话技术 会话:一次会话中包含多次请求和响应. 一次会话:浏览器第一次给服务器资源发送请求,会话建立,直到有一方断开为止 功能:在一次会话的范围内的多次请求间,共享数据 方式: 客户端会话技术:C ...

  3. ubuntu18.04管理redis

    ubuntu下 redis的安装使用 安装 1. 进入redis安装路径 cd ~/installed/redis-5.0.7 2. 启动redis 启动服务端redis-server 启动客户端(必 ...

  4. Linux 使用vim命令编辑文件内容

    在终端可以使用vim命令来直接编辑文件内容. vim,也可以叫做vi. vim有三种模式:命令模式.输入模式.底线命令模式. 命令模式 vim  文件名   进入命令模式,vim也可以写成vi. 如果 ...

  5. Android eclipse环境配置

    需下载软件: JDK eclipse ADT SDK JDK的下载安装: 从官网下载JDK:http://www.oracle.com/: 安装好以后还需要进行jdk的环境配置: eclipse下载安 ...

  6. 【WPF学习】第十七章 鼠标输入

    鼠标事件执行几个关联的任务.当鼠标移到某个元素上时,可通过最基本的鼠标事件进行响应.这些事件是MouseEnter(当鼠标指针移到元素上时引发该事件)和MouseLeave(当鼠标指针离开元素时引发该 ...

  7. 15.python文件(file)方法详解

    文件的基本操作 文件读写: 文件的读写满足以下3个步骤: 1).打开文件 2).操作数据(读.写) 3).关闭文件 --> 不要忘记 1).打开文件: python的open() 方法用于打开一 ...

  8. Elasticsearch必知必会的干货知识一:ES索引文档的CRUD

    ​ 若在传统DBMS 关系型数据库中查询海量数据,特别是模糊查询,一般我们都是使用like %查询的值%,但这样会导致无法应用索引,从而形成全表扫描效率低下,即使是在有索引的字段精确值查找,面对海量数 ...

  9. go 面向对象

    结构体 创建结构体变量和访问结构体字段 package main import "fmt" //创建结构体变量和访问结构体字段 type Person struct { Name ...

  10. 吴裕雄--天生自然 R语言数据可视化绘图(4)

    par(ask=TRUE) # Basic scatterplot library(ggplot2) ggplot(data=mtcars, aes(x=wt, y=mpg)) + geom_poin ...