| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1091357 | Psych_x7 | Martian DNA (IOI16_dna) | C++17 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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;
}
