## 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

You don't know anything about their order, but you are allowed to ask up to

Can you guess the array

The array

Interaction

Before submitting the answer, you may ask up to

To give the answer, your program should print one line

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

#include <cstdio>
#include <cstring>
#include<cmath>
#include<algorithm>
#include<iostream>
using namespace std;
int a[10]={4,8,15,16,23,42},d[5];
int main() {
for(int i=1;i<=4;i++)
{
printf("? %d %d\n",i,i+1);
fflush(stdout);
cin>>d[i];
}
do
{
if(a[1]*a[0]==d[1]&&a[2]*a[1]==d[2]&&a[3]*a[2]==d[3]&&a[4]*a[3]==d[4])
break;
}while(next_permutation(a,a+6));
printf("!");

for(int i=0;i<6;i++)
cout<<" "<<a[i];

fflush(stdout);
return 0;
}

0条评论