QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#502761#6668. TrokutiChiFAN100 ✓13ms7120kbC++144.3kb2024-08-03 13:28:072024-08-03 13:28:08

Judging History

你现在查看的是最新测评结果

  • [2024-08-03 13:28:08]
  • 评测
  • 测评结果:100
  • 用时:13ms
  • 内存:7120kb
  • [2024-08-03 13:28:07]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
const int N = 100;
int E[N+114][N+114];
int del[N+14][N+14];
int vis[N+14][N+14];
int A,B,C;
#define id(u,v) ((u-1)*N+v-1)
mt19937 rd(time(0));
vector<int> to[N*N+N+114514];
int ask(int a,int b,int c){
    if(a==b) assert(0);
    int ans;
    if(vis[a][b]==1&&vis[a][c]==1&&vis[b][c]==1){
        ans=E[a][b]+E[a][c]+E[b][c];
    }else{
        cout<<"?"<<' '<<a<<' '<<b<<' '<<c<<endl;
        cin>>ans;
    }
    return ans-del[a][b]*E[a][b]-del[b][c]*E[b][c]-del[a][c]*E[a][c];
}
void expand(int now){
    for(int v:to[now]){
        E[v%N+1][v/N+1]=E[v/N+1][v%N+1]=E[now/N+1][now%N+1]^1;
        vis[v%N+1][v/N+1]=vis[v/N+1][v%N+1]=1;
        expand(v);
    }
    to[now].clear();
}
void solve(int u,vector<int> P){
    if(P.size()==0) return ;
    if(P.size()==1){
        E[u][P[0]]=E[P[0]][u]=ask(A,u,P[0]);
        vis[u][P[0]]=vis[P[0]][u]=1;
        expand(id(u,P[0]));
        return ;
    }
    shuffle(P.begin(),P.end(),rd);
    vector<int> Q;
    if(P.size()%2==1) Q.push_back(P.back()),P.pop_back();
    for(int i=0;i<P.size();i+=2){
        int c=ask(u,P[i],P[i+1]);
        if(c==2){
            E[u][P[i]]=E[P[i]][u]=E[u][P[i+1]]=E[P[i+1]][u]=1;
            expand(id(u,P[i]));
            expand(id(u,P[i+1]));
        }else if(c==0){
            E[u][P[i]]=E[P[i]][u]=E[u][P[i+1]]=E[P[i+1]][u]=0;
            expand(id(u,P[i]));
            expand(id(u,P[i+1]));
        }else{
            to[id(u,P[i])].push_back(id(u,P[i+1]));
            Q.push_back(P[i]);
        }
    }
    solve(u,Q);
}
int flag;
vector<int> s;
void dfs(int h,int lst){
    if(h>3){
        cout<<"?"<<' '<<A<<' '<<B<<' '<<C<<endl;
        int ans;
        cin>>ans;
        if(ans==0){
            flag=1;
        }else if(ans==3){
            flag=2;
        }
        return ;
    }
    for(int i=lst+1;i<=6;i++){
        if(h==1){
            A=s[i-1];
            dfs(h+1,i);
            if(flag!=0) return ;
            A=0;
        }else if(h==2){
            B=s[i-1];
            dfs(h+1,i);
            if(flag!=0) return ;
            B=0;
        }else{
            C=s[i-1];
            dfs(h+1,i);
            if(flag!=0) return ;
            C=0;
        }
    }
}
vector<int> op;
int main(){
    set<int> S;
    while(S.size()<6){
        S.insert(rd()%N+1);
    }
    for(int x:S) s.push_back(x);
    dfs(1,0);
    if(rd()%2) swap(A,B);
    if(rd()%2) swap(B,C);
    if(flag==2) E[A][B]=E[B][A]=E[A][C]=E[C][A]=E[B][C]=E[C][B]=1;
    else E[A][B]=E[B][A]=E[A][C]=E[C][A]=E[B][C]=E[C][B]=0;
    vis[A][B]=vis[B][A]=vis[A][C]=vis[C][A]=vis[B][C]=vis[C][B]=1;
    del[A][B]=del[B][A]=1;
    del[A][C]=del[C][A]=1;
    for(int i=1;i<=N;i++) op.push_back(i);
    shuffle(op.begin(),op.end(),rd);
    for(int i:op){
        if(i!=A&&i!=B&&i!=C){
            if(rd()%2) swap(B,C);
            int f=B;
            int c=ask(A,f,i);
            if(c==2){
                E[i][A]=E[A][i]=E[i][f]=E[f][i]=1;
                int b=ask(A,C,i);
                E[i][C]=E[C][i]=b-E[A][i];
            }else if(c==0){
                E[i][A]=E[A][i]=E[i][f]=E[f][i]=0;
                int b=ask(A,C,i);
                E[i][C]=E[C][i]=b-E[A][i];
            }else{
                int g=C;
                int b=ask(A,g,i);
                if(b==2){
                    E[i][A]=E[A][i]=E[i][g]=E[g][i]=1;
                    E[i][f]=E[f][i]=0;

                }else if(b==0){
                    E[i][A]=E[A][i]=E[i][g]=E[g][i]=0;
                    E[i][f]=E[f][i]=1;
                }else{
                    int a=ask(f,g,i)-E[f][g];
                    E[i][A]=E[A][i]=(a+b+c)/2-a;
                    E[i][f]=E[f][i]=(a+b+c)/2-b;
                    E[i][g]=E[g][i]=(a+b+c)/2-c;
                }
            }
            del[i][A]=del[A][i]=1;
            vis[i][A]=vis[A][i]=vis[i][B]=vis[B][i]=vis[i][C]=vis[C][i]=1;
        }
    }
    vector<int> P;
    for(int i=1;i<=N;i++){
        if(i!=A&&i!=B&&i!=C){
            solve(i,P);
            for(int x:P) vis[i][x]=vis[x][i]=true,del[i][x]=del[x][i]=true;
            P.push_back(i);
        }
    }
    cout<<"!"<<endl;
    for(int i=1;i<=N;i++){
        for(int j=1;j<=N;j++) cout<<E[i][j];
        cout<<endl;
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 100
Accepted

Test #1:

score: 100
Accepted
time: 0ms
memory: 6912kb

input:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

output:

? 25 31 39
? 31 39 88
? 31 25 88
? 31 25 12
? 31 39 12
? 31 39 27
? 31 25 27
? 31 39 1
? 31 25 1
? 31 39 83
? 31 25 83
? 31 39 43
? 31 25 43
? 31 25 9
? 31 39 9
? 31 25 55
? 31 39 55
? 31 39 30
? 31 25 30
? 31 25 66
? 31 39 66
? 31 39 13
? 31 25 13
? 31 25 21
? 31 39 21
? 31 25 61
? 31 39 61
? 31 39...

result:

points 1.0 points  1.0 correct 2547 queries

Test #2:

score: 100
Accepted
time: 5ms
memory: 6764kb

input:

3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
...

output:

? 25 31 39
? 31 39 88
? 31 25 88
? 31 25 12
? 31 39 12
? 31 39 27
? 31 25 27
? 31 39 1
? 31 25 1
? 31 39 83
? 31 25 83
? 31 39 43
? 31 25 43
? 31 25 9
? 31 39 9
? 31 25 55
? 31 39 55
? 31 39 30
? 31 25 30
? 31 25 66
? 31 39 66
? 31 39 13
? 31 25 13
? 31 25 21
? 31 39 21
? 31 25 61
? 31 39 61
? 31 39...

result:

points 1.0 points  1.0 correct 2547 queries

Test #3:

score: 100
Accepted
time: 3ms
memory: 6776kb

input:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

output:

? 25 31 39
? 31 39 88
? 31 25 88
? 31 25 12
? 31 39 12
? 31 39 27
? 31 25 27
? 31 39 1
? 31 25 1
? 31 39 83
? 31 25 83
? 31 39 43
? 31 25 43
? 31 25 9
? 31 39 9
? 31 25 55
? 31 39 55
? 31 39 30
? 31 25 30
? 31 25 66
? 31 39 66
? 31 39 13
? 31 25 13
? 31 25 21
? 31 39 21
? 31 25 61
? 31 39 61
? 31 39...

result:

points 1.0 points  1.0 correct 2548 queries

Test #4:

score: 100
Accepted
time: 0ms
memory: 6752kb

input:

3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
...

output:

? 25 31 39
? 31 39 88
? 31 25 88
? 31 25 12
? 31 39 12
? 31 39 27
? 31 25 27
? 31 39 1
? 31 25 1
? 31 39 83
? 31 25 83
? 31 39 43
? 31 25 43
? 31 25 9
? 31 39 9
? 31 25 55
? 31 39 55
? 31 39 30
? 31 25 30
? 31 25 66
? 31 39 66
? 31 39 13
? 31 25 13
? 31 25 21
? 31 39 21
? 31 25 61
? 31 39 61
? 31 39...

result:

points 1.0 points  1.0 correct 2548 queries

Test #5:

score: 100
Accepted
time: 13ms
memory: 6744kb

input:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

output:

? 25 31 39
? 31 39 88
? 31 25 88
? 31 25 12
? 31 39 12
? 31 39 27
? 31 25 27
? 31 39 1
? 31 25 1
? 31 39 83
? 31 25 83
? 31 39 43
? 31 25 43
? 31 25 9
? 31 39 9
? 31 25 55
? 31 39 55
? 31 39 30
? 31 25 30
? 31 25 66
? 31 39 66
? 31 39 13
? 31 25 13
? 31 25 21
? 31 39 21
? 31 25 61
? 31 39 61
? 31 39...

result:

points 1.0 points  1.0 correct 2554 queries

Test #6:

score: 100
Accepted
time: 0ms
memory: 6784kb

input:

3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
...

output:

? 25 31 39
? 31 39 88
? 31 25 88
? 31 25 12
? 31 39 12
? 31 39 27
? 31 25 27
? 31 39 1
? 31 25 1
? 31 39 83
? 31 25 83
? 31 39 43
? 31 25 43
? 31 25 9
? 31 39 9
? 31 25 55
? 31 39 55
? 31 39 30
? 31 25 30
? 31 25 66
? 31 39 66
? 31 39 13
? 31 25 13
? 31 25 21
? 31 39 21
? 31 25 61
? 31 39 61
? 31 39...

result:

points 1.0 points  1.0 correct 2555 queries

Test #7:

score: 100
Accepted
time: 0ms
memory: 6748kb

input:

2
1
1
1
1
1
2
1
0
1
1
0
0
1
0
0
0
0
0
0
1
2
0
0
2
1
0
0
0
1
2
1
0
0
0
0
1
0
0
0
2
1
0
1
0
0
1
2
0
0
0
0
2
1
0
0
0
0
0
0
0
0
0
0
1
0
1
1
0
0
0
0
1
0
1
0
0
0
0
1
1
2
1
0
0
0
0
0
0
0
1
1
0
1
1
2
1
2
0
0
0
1
0
1
0
0
1
0
1
1
0
0
0
1
0
0
0
2
1
0
0
1
1
0
0
0
0
1
0
0
1
1
2
0
0
0
0
0
0
0
0
0
0
0
0
1
1
0
1
0
...

output:

? 19 27 38
? 19 27 58
? 19 27 84
? 19 27 89
? 19 38 58
? 19 38 84
? 19 38 89
? 19 58 84
? 19 58 89
? 19 89 17
? 19 58 17
? 89 58 17
? 19 58 47
? 19 89 47
? 19 89 53
? 19 58 53
? 19 58 13
? 19 89 13
? 19 89 16
? 19 58 16
? 19 58 95
? 19 89 95
? 19 89 72
? 19 58 72
? 19 58 6
? 19 89 6
? 19 58 70
? 19 ...

result:

points 1.0 points  1.0 correct 3122 queries

Test #8:

score: 100
Accepted
time: 3ms
memory: 6788kb

input:

0
0
1
0
0
1
1
0
1
2
0
0
0
1
0
1
1
1
0
0
0
1
1
0
0
1
0
1
2
1
1
1
0
0
0
0
1
1
0
1
2
0
1
1
1
0
1
1
0
0
0
0
0
1
1
2
0
1
1
0
0
0
1
1
2
0
0
0
1
1
1
2
1
0
0
1
0
0
0
0
1
0
0
0
0
1
0
1
0
0
0
0
2
2
1
1
0
0
1
1
1
0
1
1
0
0
0
2
1
1
0
0
0
1
2
0
0
0
0
0
0
1
0
1
2
1
0
0
0
1
1
0
0
0
0
1
2
1
1
1
0
1
2
1
1
2
0
0
1
0
...

output:

? 19 27 38
? 19 38 17
? 19 27 17
? 19 27 47
? 19 38 47
? 19 38 53
? 19 27 53
? 38 27 53
? 19 27 13
? 19 38 13
? 19 38 16
? 19 27 16
? 19 27 95
? 19 38 95
? 19 38 72
? 19 27 72
? 19 27 6
? 19 38 6
? 27 38 6
? 19 27 70
? 19 38 70
? 19 27 30
? 19 38 30
? 27 38 30
? 19 27 3
? 19 38 3
? 19 38 33
? 19 27 ...

result:

points 1.0 points  1.0 correct 3257 queries

Test #9:

score: 100
Accepted
time: 3ms
memory: 6780kb

input:

1
1
1
1
0
2
2
0
0
0
0
0
0
0
0
0
1
1
0
0
0
0
1
0
0
2
2
0
0
1
0
1
0
2
2
0
1
0
0
0
1
0
0
1
0
0
0
0
1
0
1
0
1
0
1
1
1
2
0
1
0
1
0
0
0
0
0
1
1
0
0
1
1
0
0
1
0
1
1
0
0
0
1
0
0
0
1
1
2
0
1
0
0
1
0
1
1
2
2
2
2
2
1
1
2
1
0
0
0
0
0
0
1
0
0
2
2
1
0
1
1
2
0
1
1
0
1
0
0
1
0
0
1
0
1
0
1
0
1
1
2
0
1
1
1
2
0
0
1
1
...

output:

? 19 27 38
? 19 27 58
? 19 27 84
? 19 27 89
? 19 38 58
? 19 58 17
? 19 38 17
? 19 38 47
? 19 58 47
? 19 58 53
? 19 38 53
? 19 38 13
? 19 58 13
? 19 58 16
? 19 38 16
? 19 38 95
? 19 58 95
? 19 58 72
? 19 38 72
? 19 38 6
? 19 58 6
? 19 38 70
? 19 58 70
? 19 38 30
? 19 58 30
? 19 38 3
? 19 58 3
? 19 58...

result:

points 1.0 points  1.0 correct 3306 queries

Test #10:

score: 100
Accepted
time: 10ms
memory: 6796kb

input:

0
0
0
0
0
2
2
0
0
0
0
2
2
2
2
0
0
2
2
0
0
0
0
0
0
2
2
2
2
0
0
2
2
2
2
0
0
0
0
0
0
2
2
0
0
2
2
2
2
2
2
2
2
0
0
2
2
2
2
0
0
0
0
2
2
2
2
2
2
2
2
2
2
2
2
2
2
0
0
2
2
0
0
0
0
2
2
0
0
2
2
0
0
0
0
0
0
0
0
2
2
0
0
0
0
2
2
0
0
0
0
2
2
0
0
2
2
2
2
2
2
2
2
0
0
2
2
2
2
2
2
2
2
0
0
0
0
0
0
2
2
2
2
0
0
2
2
2
2
0
...

output:

? 19 27 38
? 19 38 17
? 19 27 17
? 19 27 47
? 19 38 47
? 19 38 53
? 19 27 53
? 19 27 13
? 19 38 13
? 19 38 16
? 19 27 16
? 19 27 95
? 19 38 95
? 19 38 72
? 19 27 72
? 19 27 6
? 19 38 6
? 19 27 70
? 19 38 70
? 19 27 30
? 19 38 30
? 19 27 3
? 19 38 3
? 19 38 33
? 19 27 33
? 19 38 91
? 19 27 91
? 19 38...

result:

points 1.0 points  1.0 correct 3033 queries

Test #11:

score: 100
Accepted
time: 4ms
memory: 7120kb

input:

2
3
2
2
3
2
2
1
1
2
2
3
2
2
1
2
2
3
2
1
1
2
2
3
1
2
2
3
2
1
2
2
3
2
2
3
3
3
3
2
2
3
2
2
1
2
3
1
2
3
3
1
2
2
3
1
1
1
2
3
2
2
3
1
2
3
2
2
2
1
2
1
2
1
2
2
1
3
3
1
2
2
1
2
2
3
1
1
2
2
1
3
2
2
3
1
1
2
2
1
1
1
2
3
3
2
2
2
3
3
2
1
2
2
1
1
2
2
2
3
1
1
3
2
2
2
1
2
2
1
2
2
1
2
2
1
2
3
2
2
1
2
3
3
2
2
2
1
3
2
...

output:

? 19 27 38
? 19 27 58
? 19 58 17
? 19 27 17
? 58 27 17
? 19 27 47
? 19 58 47
? 27 58 47
? 19 58 53
? 19 27 53
? 19 27 13
? 19 58 13
? 19 58 16
? 19 27 16
? 58 27 16
? 19 27 95
? 19 58 95
? 27 58 95
? 19 58 72
? 19 27 72
? 19 27 6
? 19 58 6
? 19 27 70
? 19 58 70
? 19 27 30
? 19 58 30
? 19 27 3
? 19 5...

result:

points 1.0 points  1.0 correct 3378 queries

Test #12:

score: 100
Accepted
time: 0ms
memory: 6808kb

input:

3
3
3
1
2
1
1
3
3
2
3
2
2
3
1
1
1
1
2
2
1
2
2
1
2
1
1
1
2
2
1
3
3
2
1
3
2
3
3
2
1
1
1
3
2
1
2
3
3
3
2
2
3
1
1
1
2
1
1
2
1
2
1
2
1
3
2
1
2
3
2
2
3
2
2
3
1
2
2
2
1
2
3
3
2
2
1
2
2
1
2
2
1
3
3
1
2
2
1
1
1
2
1
3
2
1
2
1
1
2
2
3
3
2
3
2
1
1
2
2
3
2
3
2
3
2
3
1
2
1
1
2
3
3
2
1
2
1
2
2
2
3
2
2
3
3
2
3
2
1
...

output:

? 19 27 38
? 19 38 17
? 19 27 17
? 19 27 47
? 19 38 47
? 19 38 53
? 19 27 53
? 19 27 13
? 19 38 13
? 19 38 16
? 19 27 16
? 19 27 95
? 19 38 95
? 27 38 95
? 19 38 72
? 19 27 72
? 19 27 6
? 19 38 6
? 19 27 70
? 19 38 70
? 27 38 70
? 19 27 30
? 19 38 30
? 27 38 30
? 19 27 3
? 19 38 3
? 19 38 33
? 19 27...

result:

points 1.0 points  1.0 correct 3360 queries

Test #13:

score: 100
Accepted
time: 7ms
memory: 6856kb

input:

1
0
1
0
1
0
2
1
0
0
1
1
2
0
1
1
2
1
1
0
1
0
2
1
1
1
0
2
2
0
1
2
1
0
1
0
0
0
1
1
2
0
1
2
2
2
1
0
1
2
1
1
2
2
1
2
2
1
2
0
0
0
1
1
2
1
2
1
0
1
1
2
1
1
0
2
2
2
1
1
2
0
0
1
1
0
1
2
2
1
1
0
1
2
1
1
2
2
2
1
2
1
0
1
1
0
1
1
2
2
1
1
2
1
1
0
1
1
2
1
1
2
0
0
2
1
2
1
2
2
2
2
0
0
2
2
2
2
1
1
0
2
2
1
1
0
2
2
1
1
...

output:

? 19 27 38
? 19 27 58
? 19 58 17
? 19 27 17
? 19 27 47
? 19 58 47
? 19 58 53
? 19 27 53
? 19 27 13
? 19 58 13
? 19 58 16
? 19 27 16
? 58 27 16
? 19 27 95
? 19 58 95
? 19 58 72
? 19 27 72
? 19 27 6
? 19 58 6
? 27 58 6
? 19 27 70
? 19 58 70
? 19 27 30
? 19 58 30
? 19 27 3
? 19 58 3
? 27 58 3
? 19 58 3...

result:

points 1.0 points  1.0 correct 3345 queries

Test #14:

score: 100
Accepted
time: 4ms
memory: 6804kb

input:

2
2
1
2
2
1
1
2
2
1
2
2
3
2
2
1
2
2
1
3
2
2
3
1
1
3
2
2
3
1
1
2
1
2
2
1
3
3
2
1
2
2
3
1
1
2
2
3
2
2
3
2
3
2
1
2
1
2
2
1
2
2
1
2
1
3
2
1
2
3
3
2
2
1
3
3
1
2
2
3
2
3
3
3
3
2
2
1
1
2
2
1
2
2
3
2
2
3
2
2
1
2
1
1
2
2
1
2
3
2
2
3
2
2
3
2
2
3
1
1
2
1
2
1
2
3
3
3
3
2
2
2
1
2
1
1
2
2
2
1
2
1
2
2
3
1
1
1
1
3
...

output:

? 19 27 38
? 19 27 58
? 19 27 84
? 19 27 89
? 19 38 58
? 19 38 84
? 19 38 89
? 19 58 84
? 19 58 89
? 19 84 89
? 27 38 58
? 27 38 84
? 27 38 89
? 27 89 17
? 27 38 17
? 89 38 17
? 27 38 47
? 27 89 47
? 38 89 47
? 27 89 53
? 27 38 53
? 27 38 13
? 27 89 13
? 27 89 16
? 27 38 16
? 27 38 95
? 27 89 95
? 2...

result:

points 1.0 points  1.0 correct 3396 queries

Test #15:

score: 100
Accepted
time: 11ms
memory: 6752kb

input:

1
2
1
0
0
0
1
0
1
1
2
1
2
2
2
1
2
1
2
1
0
2
2
0
1
1
1
2
0
0
1
2
1
0
1
1
0
2
2
0
1
0
1
1
1
2
1
1
2
0
1
2
1
1
2
0
0
1
2
0
1
1
2
2
2
1
1
0
0
1
1
2
0
1
1
0
0
1
1
1
0
1
2
1
2
1
2
1
1
0
0
0
2
1
2
1
1
1
2
1
1
2
0
1
2
2
0
0
0
1
1
1
0
2
2
2
2
2
2
1
0
1
1
2
0
1
1
1
0
2
1
1
0
2
1
2
1
0
0
0
1
0
1
1
1
0
2
2
1
1
...

output:

? 19 27 38
? 19 27 58
? 19 27 84
? 19 27 89
? 19 89 17
? 19 27 17
? 19 27 47
? 19 89 47
? 19 89 53
? 19 27 53
? 89 27 53
? 19 27 13
? 19 89 13
? 19 89 16
? 19 27 16
? 19 27 95
? 19 89 95
? 19 89 72
? 19 27 72
? 19 27 6
? 19 89 6
? 19 27 70
? 19 89 70
? 19 27 30
? 19 89 30
? 19 27 3
? 19 89 3
? 27 89...

result:

points 1.0 points  1.0 correct 3306 queries

Test #16:

score: 100
Accepted
time: 3ms
memory: 6824kb

input:

2
2
2
1
1
1
1
1
2
1
1
3
1
1
2
1
3
2
1
2
2
1
1
2
2
1
1
2
2
1
1
1
2
2
1
3
2
1
2
2
1
1
1
2
2
3
2
1
1
1
2
2
1
3
3
2
2
3
1
2
2
2
1
2
2
3
2
2
3
1
1
2
3
3
2
1
2
1
1
3
3
2
2
1
2
2
3
1
2
3
2
3
3
2
1
2
3
1
2
2
3
1
1
2
3
3
2
2
3
2
1
2
2
1
2
1
2
1
1
2
1
2
1
2
2
2
1
3
2
1
2
3
3
2
2
3
1
2
1
2
3
2
3
3
3
2
2
2
3
2
...

output:

? 26 36 52
? 26 36 63
? 26 36 72
? 26 36 73
? 26 52 63
? 26 52 72
? 26 52 73
? 26 63 72
? 26 63 73
? 26 72 73
? 36 52 63
? 36 52 72
? 36 72 50
? 36 52 50
? 36 52 6
? 36 72 6
? 36 72 58
? 36 52 58
? 36 52 18
? 36 72 18
? 36 72 14
? 36 52 14
? 36 52 90
? 36 72 90
? 36 72 81
? 36 52 81
? 36 52 16
? 36 ...

result:

points 1.0 points  1.0 correct 3351 queries

Test #17:

score: 100
Accepted
time: 4ms
memory: 6760kb

input:

0
0
0
2
1
2
1
1
1
2
1
0
2
2
2
2
0
1
0
0
2
1
1
1
2
0
1
0
0
2
2
0
1
1
1
2
1
2
1
1
0
1
2
0
1
2
2
1
0
1
1
2
1
2
2
1
2
1
2
2
0
0
0
1
0
0
0
0
1
1
0
0
0
2
2
0
1
1
0
1
1
0
1
1
2
2
2
1
0
1
1
0
0
0
1
0
2
1
1
0
1
1
2
1
0
2
1
0
1
1
1
2
1
2
0
1
0
0
1
1
0
1
1
2
1
0
2
1
2
1
2
1
0
0
1
1
0
1
0
1
0
2
2
2
1
1
1
2
1
0
...

output:

? 26 36 52
? 26 52 50
? 26 36 50
? 26 36 6
? 26 52 6
? 26 52 58
? 26 36 58
? 26 36 18
? 26 52 18
? 36 52 18
? 26 52 14
? 26 36 14
? 26 36 90
? 26 52 90
? 26 52 81
? 26 36 81
? 26 36 16
? 26 52 16
? 26 52 8
? 26 36 8
? 26 36 96
? 26 52 96
? 26 36 79
? 26 52 79
? 36 52 79
? 26 36 51
? 26 52 51
? 26 52...

result:

points 1.0 points  1.0 correct 3371 queries

Test #18:

score: 100
Accepted
time: 0ms
memory: 6816kb

input:

2
2
3
1
2
3
3
1
1
1
1
3
2
1
2
2
2
1
2
3
2
3
2
1
1
2
3
2
2
2
1
1
2
1
2
3
3
1
2
1
2
1
1
2
2
1
2
2
1
1
1
1
2
3
2
2
2
3
3
2
3
2
1
1
3
2
3
2
3
2
1
1
2
1
3
2
1
2
3
3
3
3
2
2
3
2
3
2
1
2
1
2
1
2
2
3
2
3
2
2
3
2
1
2
1
1
2
1
1
2
2
3
1
1
1
1
2
1
2
2
1
1
2
3
2
3
3
3
2
1
2
3
3
2
1
2
3
3
3
2
1
2
2
1
1
2
3
2
3
3
...

output:

? 26 36 52
? 26 36 63
? 26 36 72
? 26 72 50
? 26 36 50
? 26 36 6
? 26 72 6
? 26 72 58
? 26 36 58
? 26 36 18
? 26 72 18
? 26 72 14
? 26 36 14
? 26 36 90
? 26 72 90
? 26 72 81
? 26 36 81
? 72 36 81
? 26 36 16
? 26 72 16
? 26 72 8
? 26 36 8
? 26 36 96
? 26 72 96
? 26 36 79
? 26 72 79
? 26 36 51
? 26 72...

result:

points 1.0 points  1.0 correct 3328 queries

Test #19:

score: 100
Accepted
time: 0ms
memory: 6772kb

input:

1
2
1
2
2
0
2
2
1
1
0
2
2
0
0
1
1
2
0
0
1
2
1
1
0
2
2
1
2
1
0
1
1
2
1
1
0
1
1
2
1
1
2
0
0
0
1
0
0
1
0
1
2
2
2
1
1
0
2
1
1
1
2
2
2
2
1
1
1
2
1
1
0
0
1
1
1
2
0
0
1
1
0
1
2
2
2
2
2
1
1
0
1
1
2
1
0
0
1
0
0
1
1
2
1
0
0
0
1
0
1
0
2
1
1
1
0
2
2
0
0
1
0
1
1
2
1
2
0
0
0
0
1
1
0
0
1
1
1
2
1
0
1
1
2
1
0
1
2
1
...

output:

? 26 36 52
? 26 36 63
? 26 36 72
? 26 36 73
? 26 52 63
? 26 52 72
? 26 72 50
? 26 52 50
? 26 52 6
? 26 72 6
? 52 72 6
? 26 72 58
? 26 52 58
? 26 52 18
? 26 72 18
? 26 72 14
? 26 52 14
? 72 52 14
? 26 52 90
? 26 72 90
? 26 72 81
? 26 52 81
? 26 52 16
? 26 72 16
? 52 72 16
? 26 72 8
? 26 52 8
? 26 52 ...

result:

points 1.0 points  1.0 correct 3337 queries

Test #20:

score: 100
Accepted
time: 2ms
memory: 6792kb

input:

0
0
0
2
2
2
2
1
1
0
0
1
1
0
1
1
0
1
0
0
1
0
0
2
2
1
0
2
2
1
0
0
1
1
1
2
2
2
1
1
2
0
1
0
1
1
0
1
0
1
1
2
2
1
2
2
2
2
1
2
0
0
0
0
2
2
0
1
2
2
0
1
1
1
2
2
1
1
1
0
1
2
0
1
1
1
2
1
1
2
0
1
1
2
1
1
2
1
1
0
0
1
0
1
1
1
0
1
2
2
2
1
1
0
1
1
0
0
1
2
2
2
1
1
2
1
1
2
0
0
1
0
1
1
2
1
0
2
2
1
2
0
1
1
2
0
1
1
1
2
...

output:

? 26 36 52
? 26 52 50
? 26 36 50
? 26 36 6
? 26 52 6
? 26 52 58
? 26 36 58
? 26 36 18
? 26 52 18
? 36 52 18
? 26 52 14
? 26 36 14
? 26 36 90
? 26 52 90
? 26 52 81
? 26 36 81
? 52 36 81
? 26 36 16
? 26 52 16
? 26 52 8
? 26 36 8
? 26 36 96
? 26 52 96
? 26 36 79
? 26 52 79
? 26 36 51
? 26 52 51
? 26 52...

result:

points 1.0 points  1.0 correct 3350 queries