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. 数组和CLR-非常特殊的关系

    目录 数组和CLR-非常特殊的关系 公共语言运行时(CLR)的基础 内存和类型安全 实现细节 特殊帮助器类 移除边界检查 分配数组 运行时以不同的方式对待数组 进一步阅读 数组源码引用 参考文档 数组 ...

  2. webpack构建vue单文件组件

    1.安装vue-loader和vue-template-compiler npm i vue-loader vue-template-compiler --save-dev 2.配置webpack.c ...

  3. 基于webpack的vue开发环境搭建

    1.新建并初始化项目(npm int -y),安装webpack,webpack-cli webpack-dev-server 安装eslint,eslint-plugin-vue,配置eslint语 ...

  4. cir from c# 托管堆和垃圾回收

    1,托管堆基础 调用IL的newobj 为资源分配内存 初始化内存,设置其初始状态并使资源可用.类型的实列构造器负责设置初始化状态 访问类型的成员来使用资源 摧毁状态进行清理 释放内存//垃圾回收期负 ...

  5. 多线程笔记 - provider-consumer

    通过多线程实现一个简单的生产者-消费者案例(笔记). 首先定义一个要生产消费的数据类 : public class Data { private String id; private String n ...

  6. git系列之---将本地的项目添加到码云仓库

    1.前情: 本地写的 Demo 传到码云上面进行维护. 2.操作步骤: git init   将本地文件初始化为git 仓库,文件件会多一个 .git 文件夹[版本库]: git add .   或者 ...

  7. 聊聊spring之贯穿全局的重要对象BeanDefinition

    BeanDefinition 在 spring 中贯穿始终,spring 要根据 BeanDefinition 对象来实 例化 bean,只要把解析的标签,扫描的注解类封装成 BeanDefiniti ...

  8. 《手把手教你构建自己的 Linux 系统》学习笔记(6)

    目录 /dev 目录是干什么的? /proc 和 /sys 目录是干什么的? udev 这个软件是干什么用的? 目录映射是临时性的,还是永久性的? 命令行里大括号 "{}" 的作用 ...

  9. MAC使用命令行解压rar

    使用homebrew安装unrar brew install unrar 安装完成后cd到rar文件目录,使用终端命令解压 unrar x 需要解压的文件

  10. 异步处理MultipartFile No such file or directory的分析

    背景 项目中开发导入功能,因为数据量比较大,所以要求后端异步操作(个人觉得前端ajax处理最好,有空再试一下).但是操作中发现改为异步之后,相同代码的情况下会报(No such file or dir ...