#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 972 (Div. 2) C
- Codeforces Round 982 (Div. 2)(A~C)
- Codeforces Round 986 (Div. 2) A-C
- Codeforces Round 977 (Div. 2)(B-C2)
- 【Codeforces Round #437 (Div. 2) C】 Ordering Pizza
- Codeforces Round #541 (Div. 2)
- Codeforces Round 940 (Div. 2)
- Codeforces Round 934 (Div. 2)
- Codeforces Round 932 (Div. 2)
- Codeforces Round 948 (Div. 2)
- Codeforces Round #639 (Div. 2)
- Codeforces Round #672 (Div. 2)
- Codeforces Round #682 (Div. 2)
- Codeforces Round #678 (Div. 2)
- Codeforces Round #673 (Div. 2)
- Codeforces Round 987 (Div. 2)
- Codeforces Round 976 (Div. 2)
- Codeforces Round 975 (Div. 2)
- Codeforces Round 986 (Div. 2)
- Codeforces Round 969 (Div. 2)
- Codeforces Round 873 (Div. 2)
- Codeforces Round 967 (Div. 2)
- Codeforces Round 965 (Div. 2)
- Codeforces Round 963 (Div. 2)
- Codeforces Round 979 (Div. 2)
- Codeforces Round 972 (Div. 2)
- Codeforces Round 949 (Div. 2)
- Codeforces Round 955 (Div. 2)
- Codeforces Round 951 (Div. 2)
- Codeforces Round 961 (Div. 2)
- Codeforces Round 958 (Div. 2)
- Codeforces Round 960 (Div. 2)
- Codeforces Round 953 (Div. 2)
- Codeforces Round 982 (Div. 2)
- Codeforces Round 945 (Div. 2)
- Codeforces Round #747 (Div. 2)
- Codeforces Round #665 (Div. 2)A-C題解