QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#609443#9432. Permutationucup-team004#AC ✓286ms3876kbC++232.9kb2024-10-04 13:00:472024-10-04 13:00:50

Judging History

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

  • [2024-10-04 13:00:50]
  • 评测
  • 测评结果:AC
  • 用时:286ms
  • 内存:3876kb
  • [2024-10-04 13:00:47]
  • 提交

answer

#include <bits/stdc++.h>

using i64 = long long;
using u64 = unsigned long long;
using u32 = unsigned;

// std::vector<int> ans;

// int tot = 0;
int query(const std::vector<int> &p) {
    // tot++;
    // int cnt = 0;
    // for (int i = 0; i < ans.size(); i++) {
    //     cnt += (p[i] == ans[i]);
    // }
    // return cnt;
    std::cout << 0;
    for (auto x : p) {
        std::cout << " " << x + 1;
    }
    std::cout << std::endl;
    int res;
    std::cin >> res;
    return res;
}

std::mt19937 rng(std::chrono::steady_clock::now().time_since_epoch().count());

int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    
    int n;
    std::cin >> n;
    
    // ans.resize(n);
    // std::iota(ans.begin(), ans.end(), 0);
    // std::shuffle(ans.begin(), ans.end(), rng);
    
    std::vector<int> p(n);
    auto work = [&](auto &self, int l, int r, std::vector<int> a) -> void {
        if (r - l == 1) {
            p[l] = a[0];
            return;
        }
        int m = (l + r) / 2;
        
        std::shuffle(a.begin(), a.end(), rng);
        std::vector<int> v;
        
        std::vector<int> al, ar;
        for (auto x : a) {
            if (v.empty()) {
                v.push_back(x);
            } else {
                std::vector b(n, x);
                for (int i = l; i < m; i++) {
                    b[i] = v[0];
                }
                int res = query(b);
                if (res == 0) {
                    for (auto y : v) {
                        ar.push_back(y);
                    }
                    al.push_back(x);
                    v.clear();
                } else if (res == 1) {
                    v.push_back(x);
                } else {
                    for (auto y : v) {
                        al.push_back(y);
                    }
                    ar.push_back(x);
                    v.clear();
                }
            }
        }
        if (!v.empty()) {
            if (al.empty()) {
                al = v;
            } else if (ar.empty()) {
                ar = v;
            } else {
                std::vector b(n, al[0]);
                for (int i = m; i < r; i++) {
                    b[i] = v[0];
                }
                if (query(b) == 2) {
                    std::copy(v.begin(), v.end(), std::back_inserter(ar));
                } else {
                    std::copy(v.begin(), v.end(), std::back_inserter(al));
                }
            }
        }
        self(self, l, m, al);
        self(self, m, r, ar);
    };
    std::vector<int> a(n);
    std::iota(a.begin(), a.end(), 0);
    work(work, 0, n, a);
    
    // assert(p == ans);
    // std::cerr << "tot : " << tot << "\n";
    
    std::cout << 1;
    for (int i = 0; i < n; i++) {
        std::cout << " " << p[i] + 1;
    }
    std::cout << std::endl;
    
    return 0;
}

詳細信息

Test #1:

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

input:

5
0
0
2
2
1
0
0

output:

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

result:

ok Accepted

Test #2:

score: 0
Accepted
time: 281ms
memory: 3656kb

input:

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

output:

0 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 47...

result:

ok Accepted

Test #3:

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

input:

1

output:

1 1

result:

ok Accepted

Test #4:

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

input:

2
0

output:

0 1 2
1 2 1

result:

ok Accepted

Test #5:

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

input:

3
2
2
2

output:

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

result:

ok Accepted

Test #6:

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

input:

4
1
2
2
2
0

output:

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

result:

ok Accepted

Test #7:

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

input:

6
1
2
2
2
2
2
2
2
2
0

output:

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

result:

ok Accepted

Test #8:

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

input:

7
2
0
0
2
2
2
2
2
0
0
0

output:

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

result:

ok Accepted

Test #9:

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

input:

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

output:

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

result:

ok Accepted

Test #10:

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

input:

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

output:

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

result:

ok Accepted

Test #11:

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

input:

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

output:

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

result:

ok Accepted

Test #12:

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

input:

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

output:

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

result:

ok Accepted

Test #13:

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

input:

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

output:

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

result:

ok Accepted

Test #14:

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

input:

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

output:

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

result:

ok Accepted

Test #15:

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

input:

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

output:

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

result:

ok Accepted

Test #16:

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

input:

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

output:

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

result:

ok Accepted

Test #17:

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

input:

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

output:

0 125 125 125 125 125 125 125 125 125 125 125 125 125 125 125 125 125 125 125 125 125 125 125 125 125 125 125 125 125 125 125 125 125 125 125 125 125 125 125 125 125 125 125 125 125 125 125 125 125 125 125 125 125 125 125 125 125 125 125 125 125 125 125 125 125 125 125 125 125 125 125 125 125 125 12...

result:

ok Accepted

Test #18:

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

input:

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

output:

0 915 915 915 915 915 915 915 915 915 915 915 915 915 915 915 915 915 915 915 915 915 915 915 915 915 915 915 915 915 915 915 915 915 915 915 915 915 915 915 915 915 915 915 915 915 915 915 915 915 915 915 915 915 915 915 915 915 915 915 915 915 915 915 915 915 915 915 915 915 915 915 915 915 915 91...

result:

ok Accepted

Test #19:

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

input:

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

output:

0 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 528 52...

result:

ok Accepted

Test #20:

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

input:

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

output:

0 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 247 24...

result:

ok Accepted

Test #21:

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

input:

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

output:

0 968 968 968 968 968 968 968 968 968 968 968 968 968 968 968 968 968 968 968 968 968 968 968 968 968 968 968 968 968 968 968 968 968 968 968 968 968 968 968 968 968 968 968 968 968 968 968 968 968 968 968 968 968 968 968 968 968 968 968 968 968 968 968 968 968 968 968 968 968 968 968 968 968 968 96...

result:

ok Accepted

Test #22:

score: 0
Accepted
time: 270ms
memory: 3636kb

input:

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

output:

0 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 932 93...

result:

ok Accepted

Test #23:

score: 0
Accepted
time: 256ms
memory: 3832kb

input:

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

output:

0 626 626 626 626 626 626 626 626 626 626 626 626 626 626 626 626 626 626 626 626 626 626 626 626 626 626 626 626 626 626 626 626 626 626 626 626 626 626 626 626 626 626 626 626 626 626 626 626 626 626 626 626 626 626 626 626 626 626 626 626 626 626 626 626 626 626 626 626 626 626 626 626 626 626 62...

result:

ok Accepted

Test #24:

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

input:

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

output:

0 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 480 48...

result:

ok Accepted

Test #25:

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

input:

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

output:

0 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 3...

result:

ok Accepted

Test #26:

score: 0
Accepted
time: 286ms
memory: 3656kb

input:

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

output:

0 817 817 817 817 817 817 817 817 817 817 817 817 817 817 817 817 817 817 817 817 817 817 817 817 817 817 817 817 817 817 817 817 817 817 817 817 817 817 817 817 817 817 817 817 817 817 817 817 817 817 817 817 817 817 817 817 817 817 817 817 817 817 817 817 817 817 817 817 817 817 817 817 817 817 81...

result:

ok Accepted

Test #27:

score: 0
Accepted
time: 276ms
memory: 3660kb

input:

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

output:

0 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 10...

result:

ok Accepted

Test #28:

score: 0
Accepted
time: 255ms
memory: 3592kb

input:

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

output:

0 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 51...

result:

ok Accepted

Test #29:

score: 0
Accepted
time: 273ms
memory: 3640kb

input:

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

output:

0 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 904 90...

result:

ok Accepted

Test #30:

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

input:

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

output:

0 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 580 58...

result:

ok Accepted

Test #31:

score: 0
Accepted
time: 283ms
memory: 3568kb

input:

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

output:

0 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 34...

result:

ok Accepted

Test #32:

score: 0
Accepted
time: 280ms
memory: 3568kb

input:

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

output:

0 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 187 18...

result:

ok Accepted

Test #33:

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

input:

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

output:

0 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 15...

result:

ok Accepted

Test #34:

score: 0
Accepted
time: 281ms
memory: 3668kb

input:

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

output:

0 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 190 19...

result:

ok Accepted

Test #35:

score: 0
Accepted
time: 253ms
memory: 3592kb

input:

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

output:

0 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 582 58...

result:

ok Accepted

Test #36:

score: 0
Accepted
time: 276ms
memory: 3656kb

input:

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

output:

0 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 6...

result:

ok Accepted

Test #37:

score: 0
Accepted
time: 249ms
memory: 3640kb

input:

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

output:

0 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 839 83...

result:

ok Accepted

Test #38:

score: 0
Accepted
time: 280ms
memory: 3872kb

input:

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

output:

0 151 151 151 151 151 151 151 151 151 151 151 151 151 151 151 151 151 151 151 151 151 151 151 151 151 151 151 151 151 151 151 151 151 151 151 151 151 151 151 151 151 151 151 151 151 151 151 151 151 151 151 151 151 151 151 151 151 151 151 151 151 151 151 151 151 151 151 151 151 151 151 151 151 151 15...

result:

ok Accepted

Test #39:

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

input:

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

output:

0 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 1...

result:

ok Accepted

Test #40:

score: 0
Accepted
time: 248ms
memory: 3660kb

input:

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

output:

0 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 24...

result:

ok Accepted

Test #41:

score: 0
Accepted
time: 234ms
memory: 3636kb

input:

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

output:

0 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 570 57...

result:

ok Accepted

Extra Test:

score: 0
Extra Test Passed