# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1091357 | Psych_x7 | Martian DNA (IOI16_dna) | C++17 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
#include<cstring>
//#define Psych_x7's Code
#define ll long long
#define ull unsigned long long
#define pb push_back
#define em emplace_back
#define ff first
#define ss second
#define all(v) (v.begin(), v.end())
#define rall(v) (v.rbegin(), v.rend())
#define pi acos(-1.0)
#define FastRead ios_base::sync_with_stdio(0);cin.tie(0); cout.tie(0);
#define bug(a) cerr << #a << " : " << a << endl
using namespace std;
typedef pair<int, int> Pd;
int main() {
//code
FastRead
int T,N,K,i,F,j;
scanf("%d", &T);
while(T--){
scanf("%d", &N);
F=0;
vector<char> V(N,'0');
vector<char> L;
i=1;
while(i<=N){
if(F==0){
cout.flush()<<"? ";
fflush(stdout);
for(j=0;j<i;j++){
cout.flush()<<V[j];
fflush(stdout);
}cout.flush()<<endl;
fflush(stdout);
scanf("%d", &K);
if(K==0){
F=1;
continue;
}else{
i++;
continue;
}
}if(F==1){
V[i-1]='1';
cout.flush()<<"? ";
fflush(stdout);
for(j=0;j<i;j++){
cout.flush()<<V[j];
fflush(stdout);
}cout.flush()<<endl;
fflush(stdout);
scanf("%d", &K);
if(K==0){
i--;
break;
}
i++;
F=0;
}
}
K=N-i;
for(j=0;j<K;j++){
L.em('1');
}for(j=0;j<i;j++){
L.em(V[j]);
}cout.flush()<<"! ";
fflush(stdout);
for(i=0;i<N;i++){
cout.flush()<<L[i];
fflush(stdout);
}cout.flush()<<endl;
fflush(stdout);
}
return 0;
}