QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#594959#9432. Permutationucup-team2112#AC ✓277ms3948kbC++207.7kb2024-09-28 11:36:072024-09-28 11:36:07

Judging History

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

  • [2024-09-28 11:36:07]
  • 评测
  • 测评结果:AC
  • 用时:277ms
  • 内存:3948kb
  • [2024-09-28 11:36:07]
  • 提交

answer

#include <bits/stdc++.h>

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

void solve(){
    int n;
    std::cin >> n;
    if (n == 1) {
        std::cout << 1 << " " << 1 << std::endl;
        return;
    }

    // std::vector<int> p(n + 1);
    // std::iota(p.begin(), p.end(), 0);
    // shuffle(p.begin() + 1, p.end(), rng);

    // for (int i = 1; i <= n; i += 1){
    //     std::cerr << p[i] << " ";
    // }
    // std::cerr << "\n";
    int cnt = 0;
    auto answer = [&](std::vector<int> a) {
        cnt += 1;
        std::cout << 0 << " ";
        for (int i = 1; i <= n; i += 1){
            std::cout << a[i] << " ";
        }
        std::cout << std::endl;
        int res = 0;
        std::cin >> res;
        // for (int i = 1; i <= n; i += 1){
        //     res += a[i] == p[i];
        // }
        return res;
    };

    int pos;

    auto ask_one = [&](int l, int r, int x) {
        int mid = l + r >> 1;
        std::vector<int> a = {0};
        for (int i = 1; i < l; i += 1) {
            if (i == pos) a.emplace_back(n);
            else a.emplace_back(1);
        }
        for (int i = l; i <= mid; i += 1) {
            a.emplace_back(x);
        }
        for (int i = mid + 1; i <= n; i += 1) {
           if (i == pos) a.emplace_back(n);
            else a.emplace_back(1);
        }
        int res = answer(a);
        return res;
    };

    auto ask_two = [&](int l, int r, int x, int y) {
        int mid = l + r >> 1;
        std::vector<int> a = {0};
        for (int i = 1; i < l; i += 1) {
            if (i == pos) a.emplace_back(n);
            else a.emplace_back(1);
        }
        for (int i = l; i <= mid; i += 1) {
            a.emplace_back(x);
        }
        for (int i = mid + 1; i <= r; i += 1) {
            a.emplace_back(y);
        }
        for (int i = r + 1; i <= n; i += 1) {
            if (i == pos) a.emplace_back(n);
            else a.emplace_back(1);
        }
        int res = answer(a);
        return res;
    };


    while(true){
        int i = rng() % n + 1;
        if (i == 1) continue;
        std::vector<int> a = {0};
        for (int j = 1; j <= n / 2; j += 1) {
            a.emplace_back(1);
        }
        for (int j = n / 2 + 1; j <= n; j += 1) {
            a.emplace_back(i);
        }
        int res = answer(a);
        if (res == 1) continue;
        int lo, hi;
        if (res == 2) {
            lo = 1, hi = n / 2;
        }
        else {
            lo = n / 2 + 1, hi = n;
        }
        pos = hi;
        while(hi >= lo) {
            int mid = lo + hi >> 1;
            std::vector<int> a = {0};
            for (int j = 1; j < lo; j += 1) {
                a.emplace_back(i);
            }
            for (int j = lo; j <= mid; j += 1) {
                a.emplace_back(1);
            }
            for (int j = mid + 1; j <= n; j += 1) {
                a.emplace_back(i);
            }
            res = answer(a);
            if (res - 1 == 1) {
                hi = mid - 1;
                pos = mid;
            }
            else {
                lo = mid + 1;
            }
        }
        break;
    }

    // std::cerr << "first" << " " << cnt << "\n";

    std::vector<int> res(n + 1);
    res[pos] = 1;
    std::function<void(int, int, std::vector<int>) > cal = [&](int l, int r, std::vector<int> a) {
        // std::cerr << l << " " << r << std::endl;
        if (l == r) {
            assert(a.size() == 1);
            res[l] = a[0];
            return;
        }
        int mid = l + r >> 1;
        std::vector<int> b, c;
        for (int i = 0; i < a.size(); i += 1) {
            if(i % 2) b.emplace_back(a[i]);
            else c.emplace_back(a[i]);
        }
        std::vector<std::pair<int, int> > d;
        std::vector<int> gol, gor;
        while(not b.empty() and not c.empty()) {
            int x = b.back();
            int y = c.back();
            b.pop_back();
            c.pop_back();
            int res = ask_two(l, r, x, y);
            if (res == 0) {
                gor.emplace_back(x);
                gol.emplace_back(y);
            }
            if (res == 2) {
                gol.emplace_back(x);
                gor.emplace_back(y);
            }
            if (res == 1) {
                // std::cerr << x << " " << y << std::endl;
                d.emplace_back(x, y);
            }

        }
        while(not b.empty()) {
            int x = b.back();
            b.pop_back();
            int res = ask_one(l, r, x);
            if (res == 1) {
                gol.emplace_back(x);
            }
            else {
                gor.emplace_back(x);
            }
        }
        while(not c.empty()) {
            int x = c.back();
            c.pop_back();
            int res = ask_one(l, r, x);
            if (res == 1) {
                gol.emplace_back(x);
            }
            else {
                gor.emplace_back(x);
            }
        }


        // for (auto [x, y] : d) {
        //     std::cerr << x << " " << y << std::endl;
        // }
        // std::cerr << "gol: ";
        // for (auto x : gol) std::cerr << x << " ";
        // std::cerr << std::endl;
        // std::cerr << "gor: ";
        // for (auto x : gor) std::cerr << x << " ";
        // std::cerr << std::endl;


        int j = 0;
        for (int i = 1; i < d.size(); i += 1) {
            int x = d[i - 1].first;
            int y = d[i].first;
            int res = ask_two(l, r, x, y);
            if (res == 1) {
                continue;
            }
            if (res == 0) {
                for (int k = j; k < i; k += 1) {
                    auto [xx, yy] = d[k];
                    gor.emplace_back(xx);
                    gor.emplace_back(yy);
                }
                auto [xx, yy] = d[i];
                gol.emplace_back(xx);
                gol.emplace_back(yy);
            }
            if (res == 2) {
                for (int k = j; k < i; k += 1) {
                    auto [xx, yy] = d[k];
                    gol.emplace_back(xx);
                    gol.emplace_back(yy);
                }
                auto [xx, yy] = d[i];
                gor.emplace_back(xx);
                gor.emplace_back(yy);
            }
            j = i + 1;
            i += 1;
        }
        int num = int(d.size()) - j;
        num *= 2; 

        int t = 0;
        if (gol.size() + num == mid - l + 1) {
            t = 0;
        }
        else {
            t = 1;
        }

        // std::cout << "fff: " << d[0].first << " " << d[0].second << " " << gol.size() << " " << gor.size() << " " << num << " " << l << " " << mid << " " << r << std::endl;
        for (int k = j; k < d.size(); k += 1) {
            auto [xx, yy] = d[k];
            if (t == 0) {
                gol.emplace_back(xx);
                gol.emplace_back(yy);
            }
            else {
                gor.emplace_back(xx);
                gor.emplace_back(yy);
            }
        }
        assert(mid - l + 1 == gol.size());
        assert(r - mid == gor.size());
        cal(l, mid, gol);
        cal(mid + 1, r, gor);
    };
    std::vector<int> a;
    for (int i = 1; i <= n; i += 1) {
        a.emplace_back(i);
    }
    cal(1, n, a);

    std::cout << 1 << " ";
    for (int i = 1; i <= n; i += 1) {
        std::cout << res[i] << " ";
    }
    std::cout << std::endl;

    // assert(res == p);
    // std::cerr << cnt << "\n";
}


int main(){
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    std::cout.tie(nullptr);
    solve();
    return 0;
}

詳細信息

Test #1:

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

input:

5
0
2
1
2
1
0
0
1
0
2

output:

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

result:

ok Accepted

Test #2:

score: 0
Accepted
time: 268ms
memory: 3676kb

input:

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

output:

0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

result:

ok Accepted

Test #3:

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

input:

1

output:

1 1

result:

ok Accepted

Test #4:

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

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: 3652kb

input:

3
1
1
0
2
0
1
0

output:

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

result:

ok Accepted

Test #6:

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

input:

4
1
0
1
2
1
1
2
2
0

output:

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

result:

ok Accepted

Test #7:

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

input:

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

output:

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

result:

ok Accepted

Test #8:

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

input:

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

output:

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

result:

ok Accepted

Test #9:

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

input:

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

output:

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

result:

ok Accepted

Test #10:

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

input:

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

output:

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

result:

ok Accepted

Test #11:

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

input:

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

output:

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

result:

ok Accepted

Test #12:

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

input:

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

output:

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

result:

ok Accepted

Test #13:

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

input:

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

output:

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

result:

ok Accepted

Test #14:

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

input:

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

output:

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

result:

ok Accepted

Test #15:

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

input:

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

output:

0 1 1 1 1 1 1 1 7 7 7 7 7 7 7 
0 1 1 1 1 1 1 1 12 12 12 12 12 12 12 
0 1 1 1 1 12 12 12 12 12 12 12 12 12 12 
0 1 1 12 12 12 12 12 12 12 12 12 12 12 12 
0 12 12 1 12 12 12 12 12 12 12 12 12 12 12 
0 14 14 14 14 14 14 14 13 13 13 13 13 13 13 
0 12 12 12 12 12 12 12 11 11 11 11 11 11 11 
0 10 10 10 10...

result:

ok Accepted

Test #16:

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

input:

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

output:

0 1 1 1 1 1 1 1 7 7 7 7 7 7 7 7 
0 1 1 1 1 1 1 1 5 5 5 5 5 5 5 5 
0 1 1 1 1 5 5 5 5 5 5 5 5 5 5 5 
0 1 1 5 5 5 5 5 5 5 5 5 5 5 5 5 
0 5 5 1 5 5 5 5 5 5 5 5 5 5 5 5 
0 14 14 14 14 14 14 14 14 15 15 15 15 15 15 15 
0 12 12 12 12 12 12 12 12 13 13 13 13 13 13 13 
0 10 10 10 10 10 10 10 10 11 11 11 11 1...

result:

ok Accepted

Test #17:

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

input:

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

output:

0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

result:

ok Accepted

Test #18:

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

input:

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

output:

0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

result:

ok Accepted

Test #22:

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

input:

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

output:

0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

result:

ok Accepted

Test #23:

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

input:

981
2
1
2
1
1
2
1
1
1
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1 1 1 1 1 1 1 1 1 1 ...

result:

ok Accepted

Test #31:

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

input:

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

output:

0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

result:

ok Accepted

Test #32:

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

input:

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

output:

0 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