Educational Codeforces Round 65 (Rated for Div. 2)B. Lost Numbers(交互)
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.
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.
16
64
345
672
? 1 1
? 2 2
? 3 5
? 4 6
! 4 8 15 16 23 42
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(交互)的更多相关文章
- 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 ...
- 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 ...
- Educational Codeforces Round 65 (Rated for Div. 2)题解
Educational Codeforces Round 65 (Rated for Div. 2)题解 题目链接 A. Telephone Number 水题,代码如下: Code #include ...
- 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 ...
- 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 ...
- 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 ...
- [ 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 ...
- Educational Codeforces Round 65 (Rated for Div. 2)
A:签到. #include<bits/stdc++.h> using namespace std; #define ll long long #define inf 1000000010 ...
- Educational Codeforces Round 65 (Rated for Div. 2) E. Range Deleting(思维+coding)
传送门 参考资料: [1]:https://blog.csdn.net/weixin_43262291/article/details/90271693 题意: 给你一个包含 n 个数的序列 a,并且 ...
随机推荐
- 用msi安装MySQL时MySQL Server组件不能安装,或安装失败
我的环境: MySQL8.0.15, win10 错误描述:在安装MySQL时,如果MySQL Server组件提示不能安装,错误提示是:VS 2015没有安装或安装失败.原因 ...
- Serverless + Egg.js 后台管理系统实战
本文将介绍如何基于 Egg.js 和 Serverless 实现一个后台管理系统 作为一名前端开发者,在选择 Nodejs 后端服务框架时,第一时间会想到 Egg.js,不得不说 Egg.js 是一个 ...
- JS推箱子游戏
<!DOCTYPE html><html><head><meta charset="UTF-8"><title>Inse ...
- 图解css3学习笔记
(0)css3是啥 css3是最新版本的css,添加了许多新的特性,将切图仔从繁重的工作中解救出来. css3现在主流的浏览器大部分都支持(ie9部分支持,ie8之前的都不支持) 渐进增强,优雅降级 ...
- 利用Graphics的截图功能CopyFromScreen
该方式是直接对屏幕进行截图操作 UserControl chartContainPanel = new UserControl(); Graphics graph = chartContainPane ...
- CentOS安装python3环境
CentOS7.4安装python3环境 (Python 3.8.1) (stable version, Dec.18, 2019) # .从官网下载Python - Dec. , [stable v ...
- 记一次Postgres CPU爆满故障
问题描述 公司项目测试环境调用某些接口的时候,服务器立即崩溃,并一定时间内无法提供服务. 问题排查 服务器配置不够 第一反应是服务器需要升配啦,花钱解决一切!毕竟测试服务器配置确实不高,2CPU + ...
- 详细讲解Codeforces Round #624 (Div. 3) E. Construct the Binary Tree(构造二叉树)
题意:给定节点数n和所有节点的深度总和d,问能否构造出这样的二叉树.能,则输出“YES”,并且输出n-1个节点的父节点(节点1为根节点). 题解:n个节点构成的二叉树中,完全(满)二叉树的深度总和最小 ...
- ts中的泛型
/** * 泛型:软件工程中,我们不仅要创造定义良好的API,同时也要考虑可重用行,组件不仅能 * 够支持当前的数据类型,同时也能够支持未来数据类型. * 通俗理解:泛型就是解决类.接口.方法的复用性 ...
- P1832题解 A+B Problem(再升级)
万能的打表 既然说到素数,必须先打素数表筛出素数, 每个素数可以无限取,这就是完全背包了. 这次打个质数表: bool b[1001]={1,1,0,0,1,0,1,0,1,1,1,0,1,0,1,1 ...