QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#652120#9432. PermutationUESTC_Snow_Halation#AC ✓261ms4020kbC++146.3kb2024-10-18 18:21:442024-10-18 18:22:17

Judging History

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

  • [2024-10-18 18:22:17]
  • 评测
  • 测评结果:AC
  • 用时:261ms
  • 内存:4020kb
  • [2024-10-18 18:21:44]
  • 提交

answer

#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
#include <cmath>
#define FOR() int le=e[u].size();for(int i=0;i<le;i++)
#define QWQ cout<<"QwQ\n";
#define ll long long
#include <vector>
#include <queue>
#include <map>
#define poly vector<int>

using namespace std;
const int N=5010;
const int qwq=303030;
const int inf=0x3f3f3f3f;

inline int read() {
    int sum = 0, ff = 1; char c = getchar();
    while(c<'0' || c>'9') { if(c=='-') ff = -1; c = getchar(); }
    while(c>='0'&&c<='9') { sum = sum * 10 + c - '0'; c = getchar(); }
    return sum * ff;
}

int n;
poly zong,ling;
int id[N];
int ans[N];
int tim;
int a[N];
int yi1[N],yi2[N],cnt;

int ask() {
    tim++;
    if(tim>6660) { while(tim++) { tim--; } }
    cout<<"0 ";
    for(int i=1;i<=n;i++) cout<<a[i]<<" \n"[i==n];
    fflush(stdout);
    return read();
}

void outing() {
    cout<<"1 ";
    for(int i=1;i<=n;i++) cout<<ans[i]<<" ";
    fflush(stdout);
}

inline void fuzhi(int cl) { for(int i=1;i<=n;i++) a[i] = cl; }

void solve(int l,int r,poly now,int cl) {
    // cout<<"l = "<<l<<" r = "<<r<<" cl = "<<cl<<" : ";
    // for(int v : now) cout<<v<<" ";
    // cout<<endl;
    if(l==r) { ans[ id[l] ] = now[0]; return ; }
    if(r-l==1) {
        fuzhi(cl); a[ id[l] ] = now[0];
        int wo = ask()-1;
        if(wo) {
            ans[ id[l] ] = now[0];
            ans[ id[l+1] ] = now[1];
        }
        else {
            ans[ id[l] ] = now[1];
            ans[ id[l+1] ] = now[0];
        }
        return ;
    }
    poly xia = ling;
    if(r-l==2 && cl) {
        fuzhi(cl); a[ id[l] ] = now[0];
        int wo = ask()-1;
        if(wo) {
            ans[ id[l] ] = now[0];
            xia.push_back(now[1]);
            xia.push_back(now[2]);
            solve(l+1,r,xia,cl);
            return ;
        }
        a[ id[l] ] = now[1];
        wo = ask()-1;
        if(wo) {
            ans[ id[l] ] = now[1];
            xia.push_back(now[0]);
            xia.push_back(now[2]);
            solve(l+1,r,xia,cl);
            return ;
        }
        ans[ id[l] ] = now[2];
        xia.push_back(now[0]);
        xia.push_back(now[1]);
        solve(l+1,r,xia,cl);
        return ;
    }
    if(r-l==3 && cl) {
        fuzhi(cl); a[ id[l] ] = now[0];
        int wo = ask()-1;
        if(wo) {
            ans[ id[l] ] = now[0];
            xia.push_back(now[1]);
            xia.push_back(now[2]);
            xia.push_back(now[3]);
            solve(l+1,r,xia,cl);
            return ;
        }
        a[ id[l] ] = now[1];
        wo = ask()-1;
        if(wo) {
            ans[ id[l] ] = now[1];
            xia.push_back(now[0]);
            xia.push_back(now[2]);
            xia.push_back(now[3]);
            solve(l+1,r,xia,cl);
            return ;
        }
        a[ id[l] ] = now[2];
        wo = ask()-1;
        if(wo) {
            ans[ id[l] ] = now[2];
            xia.push_back(now[0]);
            xia.push_back(now[1]);
            xia.push_back(now[3]);
            solve(l+1,r,xia,cl);
            return ;
        }
        ans[ id[l] ] = now[3];
        xia.push_back(now[0]);
        xia.push_back(now[1]);
        xia.push_back(now[2]);
        solve(l+1,r,xia,cl);
        return ;
    }

    cnt = 0;
    poly L = ling;
    poly R = ling;

    int mid = l+r >> 1;
    for(int i=0;i+1<now.size();i+=2) {
        int u = now[i], v = now[i+1];
        fuzhi(cl);
        for(int j=l;j<=mid;j++) a[ id[j] ] = u;
        for(int j=mid+1;j<=r;j++) a[ id[j] ] = v;
        int wo = ask(); if(cl) wo--;
        if(wo==1) {
            yi1[++cnt] = u;
            yi2[cnt] = v;
        }
        else if(wo==0) {
            L.push_back(v);
            R.push_back(u);
        }
        else {
            L.push_back(u);
            R.push_back(v);
        }
    }
    int tian = cl;
    if(!tian) tian = R[0];
    for(int i=1;i+1<=cnt;i+=2) {
        int A = yi1[i], B = yi2[i], C = yi1[i+1], D = yi2[i+1];
        fuzhi(cl);
        for(int j=l;j<=mid;j++) a[ id[j] ] = A;
        for(int j=mid+1;j<=r;j++) a[ id[j] ] = D;
        int wo = ask(); if(cl) wo--;
        if(wo==0) {
            R.push_back(A);
            R.push_back(B);
            L.push_back(C);
            L.push_back(D);
        }
        if(wo==2) {
            R.push_back(C);
            R.push_back(D);
            L.push_back(A);
            L.push_back(B);
        }
        if(wo==1) {
            for(int j=l;j<=mid;j++) a[ id[j] ] = tian;
            int wo = ask(); if(cl) wo--;
            if(wo) {
                R.push_back(A);
                R.push_back(B);
                R.push_back(C);
                R.push_back(D);
            }
            else {
                L.push_back(A);
                L.push_back(B);
                L.push_back(C);
                L.push_back(D);
            }
        }
    }

    if(cnt&1) {
        int i = cnt;
        fuzhi(tian);
        for(int j=mid+1;j<=r;j++) a[ id[j] ] = yi2[i];
        int wo = ask(); if(cl) wo--;
        if(wo) {
            R.push_back(yi1[i]);
            R.push_back(yi2[i]);
        }
        else {
            L.push_back(yi1[i]);
            L.push_back(yi2[i]);
        }
    }

    if(L.size()!=(mid-l+1)) L.push_back(now.back());
    if(R.size()!=(r-mid)) R.push_back(now.back());
    solve(l,mid,L,R[0]);
    solve(mid+1,r,R,L[0]);
}

int main() {
    srand(time(NULL));
    n = read();
    if(n==1) {
        ans[1] = 1;
        outing();
        return 0;
    }
    if(n<=70) {
        int yi = 0;
        for(int i=1;i<=n;i++) {
            fuzhi(2); a[i] = 1;
            int wo = ask();
            if(wo==2) {yi = i; break;}
        }
        ans[yi] = 1;
        for(int i=1;i<=n;i++) {
            if(i==yi) continue;
            fuzhi(1);
            for(int j=2;j<=n;j++) {
                a[i] = j;
                int wo = ask();
                if(wo==2) {
                    ans[i] = j;
                    break;
                }
            }
        }
        outing();
        return 0;
    }

    for(int i=1;i<=n;i++) id[i] = i, zong.push_back(i);
    random_shuffle(id+1,id+n+1);
    solve(1,n,zong,0);
    outing();
    
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3648kb

input:

5
1
1
0
2
1
2
1
1
2
2
1
1
1
2

output:

0 1 2 2 2 2
0 2 1 2 2 2
0 2 2 1 2 2
0 2 2 2 1 2
0 2 1 1 1 1
0 3 1 1 1 1
0 1 2 1 1 1
0 1 3 1 1 1
0 1 4 1 1 1
0 1 1 2 1 1
0 1 1 1 1 2
0 1 1 1 1 3
0 1 1 1 1 4
0 1 1 1 1 5
1 3 4 2 1 5 

result:

ok Accepted

Test #2:

score: 0
Accepted
time: 244ms
memory: 4020kb

input:

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

output:

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

result:

ok Accepted

Test #3:

score: 0
Accepted
time: 1ms
memory: 3784kb

input:

1

output:

1 1 

result:

ok Accepted

Test #4:

score: 0
Accepted
time: 1ms
memory: 3648kb

input:

2
0
2
2

output:

0 1 2
0 2 1
0 2 1
1 2 1 

result:

ok Accepted

Test #5:

score: 0
Accepted
time: 1ms
memory: 3712kb

input:

3
1
2
1
2
2

output:

0 1 2 2
0 2 1 2
0 2 1 1
0 3 1 1
0 1 1 2
1 3 1 2 

result:

ok Accepted

Test #6:

score: 0
Accepted
time: 1ms
memory: 3976kb

input:

4
1
1
0
2
1
2
1
1
2
2

output:

0 1 2 2 2
0 2 1 2 2
0 2 2 1 2
0 2 2 2 1
0 2 1 1 1
0 3 1 1 1
0 1 2 1 1
0 1 3 1 1
0 1 4 1 1
0 1 1 2 1
1 3 4 2 1 

result:

ok Accepted

Test #7:

score: 0
Accepted
time: 1ms
memory: 3784kb

input:

6
1
1
0
2
1
2
1
1
2
2
1
1
1
1
2
1
1
1
2

output:

0 1 2 2 2 2 2
0 2 1 2 2 2 2
0 2 2 1 2 2 2
0 2 2 2 1 2 2
0 2 1 1 1 1 1
0 3 1 1 1 1 1
0 1 2 1 1 1 1
0 1 3 1 1 1 1
0 1 4 1 1 1 1
0 1 1 2 1 1 1
0 1 1 1 1 2 1
0 1 1 1 1 3 1
0 1 1 1 1 4 1
0 1 1 1 1 5 1
0 1 1 1 1 6 1
0 1 1 1 1 1 2
0 1 1 1 1 1 3
0 1 1 1 1 1 4
0 1 1 1 1 1 5
1 3 4 2 1 6 5 

result:

ok Accepted

Test #8:

score: 0
Accepted
time: 0ms
memory: 3648kb

input:

7
1
1
0
2
1
2
1
1
1
1
1
2
2
1
1
1
1
2
1
1
1
2
1
1
2

output:

0 1 2 2 2 2 2 2
0 2 1 2 2 2 2 2
0 2 2 1 2 2 2 2
0 2 2 2 1 2 2 2
0 2 1 1 1 1 1 1
0 3 1 1 1 1 1 1
0 1 2 1 1 1 1 1
0 1 3 1 1 1 1 1
0 1 4 1 1 1 1 1
0 1 5 1 1 1 1 1
0 1 6 1 1 1 1 1
0 1 7 1 1 1 1 1
0 1 1 2 1 1 1 1
0 1 1 1 1 2 1 1
0 1 1 1 1 3 1 1
0 1 1 1 1 4 1 1
0 1 1 1 1 5 1 1
0 1 1 1 1 6 1 1
0 1 1 1 1 1 ...

result:

ok Accepted

Test #9:

score: 0
Accepted
time: 1ms
memory: 3776kb

input:

8
1
1
0
2
1
2
1
1
1
1
1
2
2
1
1
1
1
2
1
1
1
2
1
1
2
1
1
1
1
1
1
2

output:

0 1 2 2 2 2 2 2 2
0 2 1 2 2 2 2 2 2
0 2 2 1 2 2 2 2 2
0 2 2 2 1 2 2 2 2
0 2 1 1 1 1 1 1 1
0 3 1 1 1 1 1 1 1
0 1 2 1 1 1 1 1 1
0 1 3 1 1 1 1 1 1
0 1 4 1 1 1 1 1 1
0 1 5 1 1 1 1 1 1
0 1 6 1 1 1 1 1 1
0 1 7 1 1 1 1 1 1
0 1 1 2 1 1 1 1 1
0 1 1 1 1 2 1 1 1
0 1 1 1 1 3 1 1 1
0 1 1 1 1 4 1 1 1
0 1 1 1 1 5 ...

result:

ok Accepted

Test #10:

score: 0
Accepted
time: 1ms
memory: 3704kb

input:

9
1
1
0
2
1
2
1
1
1
1
1
2
2
1
1
1
1
1
1
1
2
1
1
1
2
1
1
2
1
1
1
1
1
1
2
1
1
1
1
2

output:

0 1 2 2 2 2 2 2 2 2
0 2 1 2 2 2 2 2 2 2
0 2 2 1 2 2 2 2 2 2
0 2 2 2 1 2 2 2 2 2
0 2 1 1 1 1 1 1 1 1
0 3 1 1 1 1 1 1 1 1
0 1 2 1 1 1 1 1 1 1
0 1 3 1 1 1 1 1 1 1
0 1 4 1 1 1 1 1 1 1
0 1 5 1 1 1 1 1 1 1
0 1 6 1 1 1 1 1 1 1
0 1 7 1 1 1 1 1 1 1
0 1 1 2 1 1 1 1 1 1
0 1 1 1 1 2 1 1 1 1
0 1 1 1 1 3 1 1 1 1
...

result:

ok Accepted

Test #11:

score: 0
Accepted
time: 1ms
memory: 3948kb

input:

10
1
1
1
2
1
2
1
1
1
1
1
2
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
2
1
1
1
2
1
1
2
1
1
1
1
1
1
2
1
1
1
1
2
2

output:

0 1 2 2 2 2 2 2 2 2 2
0 2 1 2 2 2 2 2 2 2 2
0 2 2 1 2 2 2 2 2 2 2
0 2 2 2 1 2 2 2 2 2 2
0 2 1 1 1 1 1 1 1 1 1
0 3 1 1 1 1 1 1 1 1 1
0 1 2 1 1 1 1 1 1 1 1
0 1 3 1 1 1 1 1 1 1 1
0 1 4 1 1 1 1 1 1 1 1
0 1 5 1 1 1 1 1 1 1 1
0 1 6 1 1 1 1 1 1 1 1
0 1 7 1 1 1 1 1 1 1 1
0 1 1 2 1 1 1 1 1 1 1
0 1 1 3 1 1 1 ...

result:

ok Accepted

Test #12:

score: 0
Accepted
time: 1ms
memory: 3952kb

input:

11
1
1
1
2
1
2
1
1
1
1
1
2
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
2
1
1
1
2
1
1
2
1
1
1
1
1
1
1
1
1
2
1
1
1
1
2
2
1
1
1
1
1
1
2

output:

0 1 2 2 2 2 2 2 2 2 2 2
0 2 1 2 2 2 2 2 2 2 2 2
0 2 2 1 2 2 2 2 2 2 2 2
0 2 2 2 1 2 2 2 2 2 2 2
0 2 1 1 1 1 1 1 1 1 1 1
0 3 1 1 1 1 1 1 1 1 1 1
0 1 2 1 1 1 1 1 1 1 1 1
0 1 3 1 1 1 1 1 1 1 1 1
0 1 4 1 1 1 1 1 1 1 1 1
0 1 5 1 1 1 1 1 1 1 1 1
0 1 6 1 1 1 1 1 1 1 1 1
0 1 7 1 1 1 1 1 1 1 1 1
0 1 1 2 1 1 ...

result:

ok Accepted

Test #13:

score: 0
Accepted
time: 0ms
memory: 3888kb

input:

12
1
1
1
2
1
2
1
1
1
1
1
2
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
2
1
1
1
2
1
1
2
1
1
1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
1
1
1
1
1
2
1
1
2
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
2
2
1
1
1
1
1
1
2
1
1
1
1
2
1
2
1
1
1
2

output:

0 1 2 2 2 2 2 2 2 2 2 2 2 2 2
0 2 1 2 2 2 2 2 2 2 2 2 2 2 2
0 2 2 1 2 2 2 2 2 2 2 2 2 2 2
0 2 2 2 1 2 2 2 2 2 2 2 2 2 2
0 2 1 1 1 1 1 1 1 1 1 1 1 1 1
0 3 1 1 1 1 1 1 1 1 1 1 1 1 1
0 4 1 1 1 1 1 1 1 1 1 1 1 1 1
0 5 1 1 1 1 1 1 1 1 1 1 1 1 1
0 6 1 1 1 1 1 1 1 1 1 1 1 1 1
0 7 1 1 1 1 1 1 1 1 1 1 1 1 1
...

result:

ok Accepted

Test #16:

score: 0
Accepted
time: 1ms
memory: 3712kb

input:

15
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
2
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
2
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
2
2
1
1
1
1
1
1
2
1
1
1
1
2
1
2
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
2

output:

0 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2
0 2 1 2 2 2 2 2 2 2 2 2 2 2 2 2
0 2 2 1 2 2 2 2 2 2 2 2 2 2 2 2
0 2 2 2 1 2 2 2 2 2 2 2 2 2 2 2
0 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1
0 3 1 1 1 1 1 1 1 1 1 1 1 1 1 1
0 4 1 1 1 1 1 1 1 1 1 1 1 1 1 1
0 5 1 1 1 1 1 1 1 1 1 1 1 1 1 1
0 6 1 1 1 1 1 1 1 1 1 1 1 1 1 1
0 7 1 1 1 1 ...

result:

ok Accepted

Test #17:

score: 0
Accepted
time: 230ms
memory: 3916kb

input:

975
1
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
2
1
0
1
...

output:

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

result:

ok Accepted

Test #27:

score: 0
Accepted
time: 240ms
memory: 3980kb

input:

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

output:

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

result:

ok Accepted

Test #28:

score: 0
Accepted
time: 225ms
memory: 3988kb

input:

986
2
0
2
2
2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2
...

output:

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

result:

ok Accepted

Test #38:

score: 0
Accepted
time: 261ms
memory: 3760kb

input:

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

output:

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

result:

ok Accepted

Test #39:

score: 0
Accepted
time: 254ms
memory: 3740kb

input:

997
1
1
2
1
0
2
2
1
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