#include <bits/stdc++.h>
using namespace std;
int T;
int n;
struct edge
{
int pre;
int nxt;
int val;
}e[110];
int cnt = 0,rt;
int temp;
int main()
{
scanf("%d",&T);
while(T--)
{
memset(e,0,sizeof(e));
int ed = 0;
cnt = 0,rt = 0;
scanf("%d",&n);
int lc = 1,rc = 1;
printf("? 0");
printf("\n");
fflush(stdout) ;
scanf("%d",&temp);
int flag = 0;
if(temp == 1)e[++cnt].val = 0,rt = cnt,e[cnt].pre = -1,e[cnt].nxt = -1;
else
{
printf("! ");
for(int i = 1;i <= n;i++)printf("1");
printf("\n");
fflush(stdout) ;
flag = 1;
}
if(flag == 1)
{
continue;
}
ed = rt;
ed = rt;
for(int k = 2;k <= n;k++)
{
if(lc == 1)
{
e[++cnt].val = 0;
e[cnt].nxt = rt;
e[cnt].pre = -1;
e[rt].pre = cnt;
printf("? 0");
for(int i = rt;i != -1;i = e[i].nxt)
printf("%d",e[i].val);
printf("\n");
fflush(stdout) ;
scanf("%d",&temp);
if(temp == 1)
{
rt = cnt;
continue;
}
else
{
e[cnt].val = 1;
printf("? 1");
for(int i = rt;i != -1;i = e[i].nxt)
printf("%d",e[i].val);
printf("\n");
fflush(stdout) ;
scanf("%d",&temp);
if(temp == 1)
{
rt = cnt;
continue;
}
else
{
lc = 0;
k--;
continue;
}
}
}
else
{
while(e[ed].nxt != -1)ed = e[ed].nxt;
e[++cnt].val = 0;
e[cnt].pre = ed;
e[cnt].nxt = -1;
e[ed].nxt = cnt;
printf("? ");
for(int i = rt;i != -1;i = e[i].nxt)
printf("%d",e[i].val);
printf("\n");
fflush(stdout) ;
scanf("%d",&temp);
if(temp == 1)
{
ed = cnt;
continue;
}
else
{
e[cnt].val = 1;
ed = cnt;
continue;
}
}
}
printf("! ");
for(int i = rt;i != -1;i = e[i].nxt)printf("%d",e[i].val);
printf("\n");
fflush(stdout) ;
}
return 0;
}
Codeforces Round 973 (Div. 2) C
相關文章
- Codeforces Round 973 (Div. 2)
- Codeforces Round #453 (Div. 2) C
- Codeforces Round #452 (Div. 2) C
- Codeforces Round 972 (Div. 2) C
- Codeforces Round #321 (Div. 2) C DFS
- Educational Codeforces Round 33 (Rated for Div. 2) C
- Codeforces Round #323 (Div. 2) C gcdGC
- Codeforces Round #325 (Div. 2) C 模擬
- Codeforces Round #359 (Div. 2) C DFS
- Codeforces Round #290 (Div. 2) A,B,C,D
- codeforces Round #252 (Div. 2) C - Valera and Tubes
- Codeforces Round #250 (Div. 2) C、The Child and Toy
- Codeforces Round 977 (Div. 2)(B-C2)
- Codeforces Round #639 (Div. 2)
- Codeforces Round #541 (Div. 2)
- Codeforces Round #682 (Div. 2)
- Codeforces Round #678 (Div. 2)
- Codeforces Round #747 (Div. 2)
- Codeforces Round #673 (Div. 2)
- Codeforces Round #672 (Div. 2)
- Codeforces Round #448 (Div. 2) A
- Codeforces Round #217 (Div. 2)
- Codeforces Round #256 (Div. 2)
- Codeforces Round #259 (Div. 2)
- Codeforces Round #257 (Div. 2)
- Codeforces Round #258 (Div. 2)
- Codeforces Round #171 (Div. 2)
- Codeforces Round #173 (Div. 2)
- Codeforces Round 932 (Div. 2)
- Codeforces Round 934 (Div. 2)
- Codeforces Round 940 (Div. 2)
- Codeforces Round 960 (Div. 2)
- Codeforces Round 958 (Div. 2)
- Codeforces Round 961 (Div. 2)
- Codeforces Round 948 (Div. 2)
- Codeforces Round 945 (Div. 2)
- Codeforces Round 951 (Div. 2)
- Codeforces Round 955 (Div. 2)