QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#741853#9432. PermutationremmymilkywayAC ✓292ms4088kbC++231.9kb2024-11-13 15:21:352024-11-13 15:21:52

Judging History

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

  • [2024-11-13 15:21:52]
  • 评测
  • 测评结果:AC
  • 用时:292ms
  • 内存:4088kb
  • [2024-11-13 15:21:35]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 1e3 + 5;
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
int n, ans[maxn];
int ask(int mid, int x, int y) {
    printf("0 ");
    for (int i = 1; i <= mid; i++) {
        printf("%d ", x);
    }
    for (int i = mid + 1; i <= n; i++) {
        printf("%d ", y);
    }
    printf("\n");
    fflush(stdout);
    int res;
    scanf("%d", &res);
    return res;
}
void query(int l, int r, vector<int> val) {
    if (l == r) {
        ans[l] = val[0];
        return;
    }
    int mid = (l + r) >> 1;
    shuffle(val.begin(), val.end(), rng);
    vector<int> pos0, pos1;
    int idx = 0, lst = 0;
    while (idx + 1 < (int)val.size()) {
        int cur = ask(mid, val[idx], val[idx + 1]);
        if (cur == 0) {
            for (int i = lst; i <= idx; i++) {
                pos1.push_back(val[i]);
            }
            pos0.push_back(val[idx + 1]);
            idx += 2;
            lst = idx;
        } else if (cur == 2) {
            for (int i = lst; i <= idx; i++) {
                pos0.push_back(val[i]);
            }
            pos1.push_back(val[idx + 1]);
            idx += 2;
            lst = idx;
        } else {
            idx++;
        }
    }
    if ((int)pos0.size() < mid - l + 1) {
        for (int i = lst; i <= (int)val.size() - 1; i++) {
            pos0.push_back(val[i]);
        }
    } else {
        for (int i = lst; i <= (int)val.size() - 1; i++) {
            pos1.push_back(val[i]);
        }
    }
    query(l, mid, pos0);
    query(mid + 1, r, pos1);
}
int main() {
    scanf("%d", &n);
    vector<int> cur;
    for (int i = 1; i <= n; i++) {
        cur.push_back(i);
    }
    query(1, n, cur);
    printf("1 ");
    for (int i = 1; i <= n; i++) {
        printf("%d ", ans[i]);
    }
    printf("\n");
    fflush(stdout);
    return 0;
}

詳細信息

Test #1:

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

input:

5
0
0
1
2
2
2

output:

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

result:

ok Accepted

Test #2:

score: 0
Accepted
time: 277ms
memory: 3892kb

input:

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

output:

0 370 370 370 370 370 370 370 370 370 370 370 370 370 370 370 370 370 370 370 370 370 370 370 370 370 370 370 370 370 370 370 370 370 370 370 370 370 370 370 370 370 370 370 370 370 370 370 370 370 370 370 370 370 370 370 370 370 370 370 370 370 370 370 370 370 370 370 370 370 370 370 370 370 370 37...

result:

ok Accepted

Test #3:

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

input:

1

output:

1 1 

result:

ok Accepted

Test #4:

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

input:

2
0

output:

0 1 2 
1 2 1 

result:

ok Accepted

Test #5:

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

input:

3
1
2
2

output:

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

result:

ok Accepted

Test #6:

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

input:

4
2
0
2
0

output:

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

result:

ok Accepted

Test #7:

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

input:

6
2
0
0
2
2
2
2

output:

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

result:

ok Accepted

Test #8:

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

input:

7
1
0
0
1
1
2
2
2
0
0

output:

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

result:

ok Accepted

Test #9:

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

input:

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

output:

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

result:

ok Accepted

Test #10:

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

input:

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

output:

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

result:

ok Accepted

Test #11:

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

input:

10
0
1
2
2
1
0
1
2
2
1
2
0
2
2
0
1
2
2
2

output:

0 6 6 6 6 6 9 9 9 9 9 
0 3 3 3 3 3 7 7 7 7 7 
0 7 7 7 7 7 8 8 8 8 8 
0 1 1 1 1 1 2 2 2 2 2 
0 5 5 5 5 5 4 4 4 4 4 
0 4 4 4 4 4 10 10 10 10 10 
0 7 7 7 3 3 3 3 3 3 3 
0 3 3 3 1 1 1 1 1 1 1 
0 10 10 10 9 9 9 9 9 9 9 
0 7 7 3 3 3 3 3 3 3 3 
0 3 3 10 10 10 10 10 10 10 10 
0 7 3 3 3 3 3 3 3 3 3 
0 1 1 1 ...

result:

ok Accepted

Test #12:

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

input:

11
2
1
1
0
1
1
1
2
0
1
0
0
0
2
0
2
1
2
2
2
2

output:

0 7 7 7 7 7 7 6 6 6 6 6 
0 4 4 4 4 4 4 8 8 8 8 8 
0 8 8 8 8 8 8 2 2 2 2 2 
0 2 2 2 2 2 2 1 1 1 1 1 
0 9 9 9 9 9 9 10 10 10 10 10 
0 10 10 10 10 10 10 3 3 3 3 3 
0 3 3 3 3 3 3 5 5 5 5 5 
0 5 5 5 5 5 5 11 11 11 11 11 
0 9 9 9 10 10 10 10 10 10 10 10 
0 5 5 5 1 1 1 1 1 1 1 1 
0 1 1 1 3 3 3 3 3 3 3 3 
0...

result:

ok Accepted

Test #13:

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

input:

12
1
2
1
0
0
1
2
2
0
2
0
0
2
0
1
2
1
0
0
2
0
0

output:

0 3 3 3 3 3 3 9 9 9 9 9 9 
0 9 9 9 9 9 9 4 4 4 4 4 4 
0 6 6 6 6 6 6 2 2 2 2 2 2 
0 2 2 2 2 2 2 10 10 10 10 10 10 
0 12 12 12 12 12 12 7 7 7 7 7 7 
0 5 5 5 5 5 5 1 1 1 1 1 1 
0 1 1 1 1 1 1 11 11 11 11 11 11 
0 3 3 3 1 1 1 1 1 1 1 1 1 
0 9 9 9 7 7 7 7 7 7 7 7 7 
0 10 10 10 5 5 5 5 5 5 5 5 5 
0 10 10 7...

result:

ok Accepted

Test #14:

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

input:

13
0
0
1
0
1
0
1
1
1
1
0
1
1
2
0
0
2
2
0
1
1
2
1
1
2
0
0
2

output:

0 8 8 8 8 8 8 8 4 4 4 4 4 4 
0 12 12 12 12 12 12 12 7 7 7 7 7 7 
0 11 11 11 11 11 11 11 2 2 2 2 2 2 
0 2 2 2 2 2 2 2 1 1 1 1 1 1 
0 6 6 6 6 6 6 6 3 3 3 3 3 3 
0 3 3 3 3 3 3 3 10 10 10 10 10 10 
0 9 9 9 9 9 9 9 13 13 13 13 13 13 
0 13 13 13 13 13 13 13 5 5 5 5 5 5 
0 9 9 9 9 5 5 5 5 5 5 5 5 5 
0 5 5 ...

result:

ok Accepted

Test #15:

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

input:

14
0
0
1
0
1
2
0
0
1
1
1
2
1
0
0
2
0
2
2
1
1
2
2
0
0
2
2
2
0

output:

0 2 2 2 2 2 2 2 13 13 13 13 13 13 13 
0 11 11 11 11 11 11 11 10 10 10 10 10 10 10 
0 12 12 12 12 12 12 12 3 3 3 3 3 3 3 
0 3 3 3 3 3 3 3 4 4 4 4 4 4 4 
0 14 14 14 14 14 14 14 1 1 1 1 1 1 1 
0 1 1 1 1 1 1 1 8 8 8 8 8 8 8 
0 6 6 6 6 6 6 6 9 9 9 9 9 9 9 
0 5 5 5 5 5 5 5 7 7 7 7 7 7 7 
0 13 13 13 13 7 7...

result:

ok Accepted

Test #16:

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

input:

15
0
2
0
0
0
0
0
1
2
1
1
0
1
0
0
0
0
0
2
2
2
1
2
2
0
2
0
2
2
2

output:

0 2 2 2 2 2 2 2 2 15 15 15 15 15 15 15 
0 10 10 10 10 10 10 10 10 8 8 8 8 8 8 8 
0 12 12 12 12 12 12 12 12 7 7 7 7 7 7 7 
0 5 5 5 5 5 5 5 5 11 11 11 11 11 11 11 
0 6 6 6 6 6 6 6 6 9 9 9 9 9 9 9 
0 3 3 3 3 3 3 3 3 1 1 1 1 1 1 1 
0 14 14 14 14 14 14 14 14 4 4 4 4 4 4 4 
0 7 7 7 7 10 10 10 10 10 10 10 ...

result:

ok Accepted

Test #17:

score: 0
Accepted
time: 269ms
memory: 3796kb

input:

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

output:

0 620 620 620 620 620 620 620 620 620 620 620 620 620 620 620 620 620 620 620 620 620 620 620 620 620 620 620 620 620 620 620 620 620 620 620 620 620 620 620 620 620 620 620 620 620 620 620 620 620 620 620 620 620 620 620 620 620 620 620 620 620 620 620 620 620 620 620 620 620 620 620 620 620 620 62...

result:

ok Accepted

Test #18:

score: 0
Accepted
time: 229ms
memory: 3796kb

input:

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

output:

0 689 689 689 689 689 689 689 689 689 689 689 689 689 689 689 689 689 689 689 689 689 689 689 689 689 689 689 689 689 689 689 689 689 689 689 689 689 689 689 689 689 689 689 689 689 689 689 689 689 689 689 689 689 689 689 689 689 689 689 689 689 689 689 689 689 689 689 689 689 689 689 689 689 689 68...

result:

ok Accepted

Test #19:

score: 0
Accepted
time: 250ms
memory: 3860kb

input:

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

output:

0 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 740 74...

result:

ok Accepted

Test #20:

score: 0
Accepted
time: 239ms
memory: 3844kb

input:

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

output:

0 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 430 43...

result:

ok Accepted

Test #21:

score: 0
Accepted
time: 258ms
memory: 4084kb

input:

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

output:

0 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 343 34...

result:

ok Accepted

Test #22:

score: 0
Accepted
time: 264ms
memory: 4088kb

input:

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

output:

0 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 75...

result:

ok Accepted

Test #23:

score: 0
Accepted
time: 251ms
memory: 3824kb

input:

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

output:

0 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 108 10...

result:

ok Accepted

Test #24:

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

input:

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

output:

0 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 16...

result:

ok Accepted

Test #25:

score: 0
Accepted
time: 252ms
memory: 3824kb

input:

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

output:

0 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 868 86...

result:

ok Accepted

Test #26:

score: 0
Accepted
time: 250ms
memory: 3864kb

input:

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

output:

0 267 267 267 267 267 267 267 267 267 267 267 267 267 267 267 267 267 267 267 267 267 267 267 267 267 267 267 267 267 267 267 267 267 267 267 267 267 267 267 267 267 267 267 267 267 267 267 267 267 267 267 267 267 267 267 267 267 267 267 267 267 267 267 267 267 267 267 267 267 267 267 267 267 267 26...

result:

ok Accepted

Test #27:

score: 0
Accepted
time: 267ms
memory: 3860kb

input:

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

output:

0 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 397 39...

result:

ok Accepted

Test #28:

score: 0
Accepted
time: 232ms
memory: 3796kb

input:

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

output:

0 707 707 707 707 707 707 707 707 707 707 707 707 707 707 707 707 707 707 707 707 707 707 707 707 707 707 707 707 707 707 707 707 707 707 707 707 707 707 707 707 707 707 707 707 707 707 707 707 707 707 707 707 707 707 707 707 707 707 707 707 707 707 707 707 707 707 707 707 707 707 707 707 707 707 70...

result:

ok Accepted

Test #29:

score: 0
Accepted
time: 263ms
memory: 3956kb

input:

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

output:

0 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 696 69...

result:

ok Accepted

Test #30:

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

input:

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

output:

0 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 850 85...

result:

ok Accepted

Test #31:

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

input:

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

output:

0 799 799 799 799 799 799 799 799 799 799 799 799 799 799 799 799 799 799 799 799 799 799 799 799 799 799 799 799 799 799 799 799 799 799 799 799 799 799 799 799 799 799 799 799 799 799 799 799 799 799 799 799 799 799 799 799 799 799 799 799 799 799 799 799 799 799 799 799 799 799 799 799 799 799 79...

result:

ok Accepted

Test #32:

score: 0
Accepted
time: 243ms
memory: 3816kb

input:

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

output:

0 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 12...

result:

ok Accepted

Test #33:

score: 0
Accepted
time: 241ms
memory: 4084kb

input:

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

output:

0 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 176 17...

result:

ok Accepted

Test #34:

score: 0
Accepted
time: 262ms
memory: 4084kb

input:

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

output:

0 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 74...

result:

ok Accepted

Test #35:

score: 0
Accepted
time: 269ms
memory: 3796kb

input:

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

output:

0 982 982 982 982 982 982 982 982 982 982 982 982 982 982 982 982 982 982 982 982 982 982 982 982 982 982 982 982 982 982 982 982 982 982 982 982 982 982 982 982 982 982 982 982 982 982 982 982 982 982 982 982 982 982 982 982 982 982 982 982 982 982 982 982 982 982 982 982 982 982 982 982 982 982 98...

result:

ok Accepted

Test #36:

score: 0
Accepted
time: 247ms
memory: 3840kb

input:

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

output:

0 623 623 623 623 623 623 623 623 623 623 623 623 623 623 623 623 623 623 623 623 623 623 623 623 623 623 623 623 623 623 623 623 623 623 623 623 623 623 623 623 623 623 623 623 623 623 623 623 623 623 623 623 623 623 623 623 623 623 623 623 623 623 623 623 623 623 623 623 623 623 623 623 623 623 62...

result:

ok Accepted

Test #37:

score: 0
Accepted
time: 284ms
memory: 3800kb

input:

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

output:

0 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 619 61...

result:

ok Accepted

Test #38:

score: 0
Accepted
time: 292ms
memory: 3884kb

input:

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

output:

0 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 952 95...

result:

ok Accepted

Test #39:

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

input:

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

output:

0 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 4...

result:

ok Accepted

Test #40:

score: 0
Accepted
time: 284ms
memory: 3820kb

input:

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

output:

0 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 81...

result:

ok Accepted

Test #41:

score: 0
Accepted
time: 266ms
memory: 3880kb

input:

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

output:

0 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 71...

result:

ok Accepted

Extra Test:

score: 0
Extra Test Passed