QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#443821#8647. JOI TourQwerty1232#100 ✓1691ms288160kbC++238.0kb2024-06-15 16:35:472024-06-15 16:35:51

Judging History

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

  • [2024-06-15 16:35:51]
  • 评测
  • 测评结果:100
  • 用时:1691ms
  • 内存:288160kb
  • [2024-06-15 16:35:47]
  • 提交

answer

#include <bits/stdc++.h>

#include "joitour.h"

struct ST {
    std::vector<int> data;
    int size;

    ST() = default;
    ST(int n) {
        size = 1 << std::__lg(std::max<int>(1, n - 1)) + 1;
        data.assign(size * 2, 0);
    }

    void add_point(int i, int dlt) {
        for (i += size; i > 0; i >>= 1) {
            data[i] += dlt;
        }
    }

    int get_sum_range(int l, int r) {
        int sum = 0;
        for (l += size, r += size; l < r; l >>= 1, r >>= 1) {
            if (l & 1)
                sum += data[l++];
            if (r & 1)
                sum += data[--r];
        }
        return sum;
    }

    int get_sum_point(int i) {
        int sum = 0;
        for (i += size; i > 0; i >>= 1) {
            sum += data[i];
        }
        return sum;
    }

    void add_range(int l, int r, int dlt) {
        for (l += size, r += size; l < r; l >>= 1, r >>= 1) {
            if (l & 1)
                data[l++] += dlt;
            if (r & 1)
                data[--r] += dlt;
        }
    }
};

int n;
std::vector<int> input;
std::vector<std::vector<int>> gr;
std::vector<bool> used;
std::vector<int> sz;
std::vector<int> depth, prv, ctr_deg;
struct Cum {
    int a, c;
    int64_t bc, ba;

    Cum operator-(const Cum& other) const {
        return Cum{a - other.a, c - other.c, bc - other.bc, ba - other.ba};
    }
    Cum operator+(const Cum& other) const {
        return Cum{a + other.a, c + other.c, bc + other.bc, ba + other.ba};
    }
};
std::vector<std::vector<Cum>> count;
struct Fuck {
    int64_t ans_a, ans_b, ans_c;

    Fuck operator-(const Fuck& other) const {
        return Fuck{ans_a - other.ans_a, ans_b - other.ans_b, ans_c - other.ans_c};
    }
    Fuck operator+(const Fuck& other) const {
        return Fuck{ans_a + other.ans_a, ans_b + other.ans_b, ans_c + other.ans_c};
    }

    int64_t get(int i) const {
        return i == 0 ? ans_a : (i == 1 ? ans_b : ans_c);
    }
};
std::vector<Fuck> fuck_ans;
std::vector<std::vector<int>> dist, tin, tout, eul, subtree_num;
std::vector<ST> st_a, st_b, st_c;

Fuck get_ans(Cum val, Cum /* without val */ total) {
    int64_t cum = 0;
    cum += val.a * total.bc;
    cum += val.c * total.ba;
    cum += val.ba * total.c;
    cum += val.bc * total.a;
    Fuck res{cum, cum, cum};
    res.ans_a += val.bc;
    res.ans_b += val.a * int64_t(total.c) + val.c * int64_t(total.a);
    res.ans_c += val.ba;
    return res;
}

int64_t ans;

void init(int N, std::vector<int> F, std::vector<int> U, std::vector<int> V, int Q) {
    n = N;
    input = F;
    gr.assign(n, {});
    for (int i = 0; i < n - 1; i++) {
        gr[U[i]].push_back(V[i]);
        gr[V[i]].push_back(U[i]);
    }

    ans = 0;
    sz.assign(n, 0), used.assign(n, false), depth.assign(n, -1), prv.assign(n, -1), ctr_deg.assign(n, -1);
    count.assign(n, {}), fuck_ans.assign(n, Fuck());
    dist.clear(), tin.clear(), tout.clear(), subtree_num.clear(), eul.assign(n, {});
    st_a.assign(n, {}), st_b.assign(n, {}), st_c.assign(n, {});

    auto find = [&](int v) {
        auto dfs = [&](auto dfs, int v, int f) -> void {
            sz[v] = 1;
            for (int t : gr[v]) {
                if (t != f && !used[t]) {
                    dfs(dfs, t, v);
                    sz[v] += sz[t];
                }
            }
        };
        dfs(dfs, v, -1);
        int f = -1;
        int s = sz[v];
        while (true) {
            auto it = std::find_if(gr[v].begin(), gr[v].end(), [&](int t) { return t != f && !used[t] && sz[t] > s / 2; });
            if (it != gr[v].end()) {
                f = v;
                v = *it;
            } else {
                break;
            }
        }
        return v;
    };

    auto build = [&](auto build, int u, int dp, int f) -> void {
        u = find(u);
        used[u] = true;
        depth[u] = dp;
        prv[u] = f;

        if (dist.size() == dp) {
            dist.emplace_back(n, -1);
            tin.emplace_back(n, -1);
            tout.emplace_back(n, -1);
            subtree_num.emplace_back(n, -2);
        }

        auto dfs = [&](auto dfs, int v, int f, int sn) -> int {
            tin[dp][v] = eul[u].size();
            eul[u].push_back(v);
            subtree_num[dp][v] = sn;

            int cnt = 0;
            for (int t : gr[v]) {
                if (t != f && !used[t]) {
                    dfs(dfs, t, v, f == -1 ? cnt : sn);
                    cnt++;
                }
            }
            tout[dp][v] = eul[u].size();
            return cnt;
        };
        int g = ctr_deg[u] = dfs(dfs, u, -1, -1);
        count[u].assign(g + 1, Cum());

        int m = eul[u].size();
        st_a[u] = ST(m), st_b[u] = ST(m), st_c[u] = ST(m);
        for (int i = 1; i < m; i++) {
            int v = eul[u][i];
            int sb = subtree_num[dp][v];

            if (input[v] == 0) {
                count[u][sb].a += 1;
                count[u][sb].ba += st_b[u].get_sum_point(tin[dp][v]);

                st_a[u].add_point(tin[dp][v], +1);
            } else if (input[v] == 2) {
                count[u][sb].c += 1;
                count[u][sb].bc += st_b[u].get_sum_point(tin[dp][v]);

                st_c[u].add_point(tin[dp][v], +1);
            } else {
                count[u][sb].ba += st_a[u].get_sum_range(tin[dp][v], tout[dp][v]);
                count[u][sb].bc += st_c[u].get_sum_range(tin[dp][v], tout[dp][v]);

                st_b[u].add_range(tin[dp][v], tout[dp][v], +1);
            }
        }
        fuck_ans[u] = Fuck();
        for (int i = 0; i < g; i++) {
            fuck_ans[u] = fuck_ans[u] + get_ans(count[u][i], count[u][g]);
            count[u][g] = count[u][g] + count[u][i];
        }
        ans += fuck_ans[u].get(input[u]);

        for (int t : gr[u]) {
            if (!used[t]) {
                build(build, t, dp + 1, u);
            }
        }
    };

    build(build, 0, 0, -1);
}

void change(const int v, int y) {
    int y0 = input[v];
    int u = v;
    while (u != -1) {
        int dp = depth[u];
        int sb = subtree_num[dp][v];
        input[v] = y0;

        ans -= fuck_ans[u].get(input[u]);
        if (sb != -1) {
            count[u][ctr_deg[u]] = count[u][ctr_deg[u]] - count[u][sb];
            fuck_ans[u] = fuck_ans[u] - get_ans(count[u][sb], count[u][ctr_deg[u]]);

            if (input[v] == 0) {
                count[u][sb].a -= 1;
                count[u][sb].ba -= st_b[u].get_sum_point(tin[dp][v]);
                st_a[u].add_point(tin[dp][v], -1);
            } else if (input[v] == 2) {
                count[u][sb].c -= 1;
                count[u][sb].bc -= st_b[u].get_sum_point(tin[dp][v]);
                st_c[u].add_point(tin[dp][v], -1);
            } else {
                count[u][sb].ba -= st_a[u].get_sum_range(tin[dp][v], tout[dp][v]);
                count[u][sb].bc -= st_c[u].get_sum_range(tin[dp][v], tout[dp][v]);
                st_b[u].add_range(tin[dp][v], tout[dp][v], -1);
            }
        }

        input[v] = y;

        if (sb != -1) {
            if (input[v] == 0) {
                count[u][sb].a += 1;
                count[u][sb].ba += st_b[u].get_sum_point(tin[dp][v]);
                st_a[u].add_point(tin[dp][v], +1);
            } else if (input[v] == 2) {
                count[u][sb].c += 1;
                count[u][sb].bc += st_b[u].get_sum_point(tin[dp][v]);
                st_c[u].add_point(tin[dp][v], +1);
            } else {
                count[u][sb].ba += st_a[u].get_sum_range(tin[dp][v], tout[dp][v]);
                count[u][sb].bc += st_c[u].get_sum_range(tin[dp][v], tout[dp][v]);
                st_b[u].add_range(tin[dp][v], tout[dp][v], +1);
            }

            fuck_ans[u] = fuck_ans[u] + get_ans(count[u][sb], count[u][ctr_deg[u]]);
            count[u][ctr_deg[u]] = count[u][ctr_deg[u]] + count[u][sb];
        }
        ans += fuck_ans[u].get(input[u]);

        u = prv[u];
    }
}

long long num_tours() {
    // return 0;
    return ans;
}

详细

Subtask #1:

score: 6
Accepted

Test #1:

score: 6
Accepted
time: 0ms
memory: 4164kb

input:

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

output:

597892
604453
604236
600488
598028
594449
593671
586072
582432
581797
586919
588018
591441
592178
589303
587825
591777
595845
591906
591733
593937
592286
587593
583280
582383
580941
576582
577908
579779
578590
578141
577238
577854
584168
591759
594698
591476
590496
583825
582797
581264
586076
587779...

result:

ok 

Test #2:

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

input:

3
1 2 2
0 2
0 1
100
1 0
2 0
0 2
0 0
0 1
2 1
0 2
0 1
0 2
0 1
0 2
1 2
2 2
0 1
2 0
1 0
1 2
1 0
1 1
0 2
1 2
1 0
2 2
2 0
1 1
0 1
1 2
2 1
2 2
2 0
2 2
2 0
2 1
2 0
2 1
1 1
1 0
1 1
0 0
2 0
0 1
1 0
1 2
0 0
0 1
1 1
0 0
2 2
0 1
2 0
0 2
2 2
2 1
1 2
0 1
1 1
1 2
1 0
0 2
2 0
2 1
0 0
0 1
1 2
1 1
2 2
1 2
0 2
1 1
0 1
...

output:

0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
1
0
0
1
0
1
0
1
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0

result:

ok 

Test #3:

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

input:

4
2 2 0 2
1 2
1 3
0 3
100
2 2
2 0
0 0
1 1
0 2
2 2
1 2
3 1
0 0
2 1
3 2
0 1
3 0
1 1
3 2
0 0
0 2
2 0
0 0
3 1
2 2
2 1
2 0
3 2
1 0
0 1
3 1
2 1
3 0
3 2
3 1
3 2
2 0
3 0
0 2
0 0
3 2
0 2
3 1
0 0
1 1
2 2
2 1
2 0
0 2
3 2
3 1
1 0
0 0
0 2
3 0
2 2
0 0
3 2
3 0
3 2
2 0
1 2
0 1
1 0
3 1
1 2
1 0
1 1
3 0
0 2
1 0
0 0
1 ...

output:

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

result:

ok 

Test #4:

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

input:

5
2 0 1 2 1
0 3
3 4
2 3
1 3
100
0 0
1 2
3 0
0 1
3 1
3 2
1 1
1 0
0 0
0 1
0 2
2 0
0 0
0 1
3 0
0 2
3 1
3 0
4 0
1 1
4 2
0 1
3 1
2 1
0 2
3 0
3 1
1 2
1 1
4 0
1 2
2 0
4 2
4 1
4 2
3 0
3 2
2 1
0 0
0 2
1 1
4 0
2 0
2 1
2 2
1 2
3 1
2 0
0 1
3 2
2 2
0 2
0 1
4 2
3 0
2 0
2 2
3 2
0 0
0 2
2 1
3 1
2 2
4 0
4 1
4 2
1 1
...

output:

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

result:

ok 

Test #5:

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

input:

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

output:

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

result:

ok 

Test #6:

score: 0
Accepted
time: 2ms
memory: 4356kb

input:

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

output:

89736
92089
97184
97881
97958
97957
98575
98780
98194
98636
98571
98118
98137
96880
97697
97751
97126
95885
95846
95881
95780
96554
97541
97088
97147
97124
97229
97271
97761
98723
98751
99213
99575
99558
99541
100018
99689
100639
100160
101057
98928
99588
98995
99010
98196
103072
103702
103678
10365...

result:

ok 

Test #7:

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

input:

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

output:

17280
17415
17280
17408
17272
17145
17272
17136
17000
16988
17112
16988
16851
16974
17097
17080
17202
17324
17202
17324
17466
17324
17182
17061
16940
16920
16800
16660
16541
16520
16380
16356
16497
16638
16779
16660
16520
16497
16356
16497
16638
16520
16541
16560
16577
16714
16592
16605
16728
16740
...

result:

ok 

Subtask #2:

score: 8
Accepted

Dependency #1:

100%
Accepted

Test #8:

score: 8
Accepted
time: 16ms
memory: 8224kb

input:

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

output:

620474975
620091276
620213053
620215716
620182492
619967950
620433875
620378867
619791163
620294584
620042350
620254670
619599499
619635328
619632073
619845490
620198042
620214770
620452856
620637250
620099913
620537344
620561024
620602104
620531392
620536225
620559149
621081398
621137321
621348648
...

result:

ok 

Test #9:

score: 0
Accepted
time: 6ms
memory: 7648kb

input:

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

output:

42768942
42797072
42797223
42840318
42832995
42797246
42797380
42817147
42816920
42815937
42778805
42753526
42752585
42787135
42764416
42796136
42796797
42766303
42765309
42764279
42740223
42739766
42767580
43539681
43587532
43564273
43590474
43562674
43561503
43524119
43524798
43524001
43525085
435...

result:

ok 

Test #10:

score: 0
Accepted
time: 9ms
memory: 5816kb

input:

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

output:

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

result:

ok 

Subtask #3:

score: 6
Accepted

Test #11:

score: 6
Accepted
time: 1093ms
memory: 288160kb

input:

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

output:

77241161705660

result:

ok 

Test #12:

score: 0
Accepted
time: 1087ms
memory: 287988kb

input:

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

output:

14535453821146

result:

ok 

Test #13:

score: 0
Accepted
time: 925ms
memory: 287992kb

input:

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

output:

15024455356747

result:

ok 

Test #14:

score: 0
Accepted
time: 1125ms
memory: 287980kb

input:

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

output:

14979709993295

result:

ok 

Test #15:

score: 0
Accepted
time: 297ms
memory: 247812kb

input:

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

output:

457084700208

result:

ok 

Test #16:

score: 0
Accepted
time: 302ms
memory: 247708kb

input:

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

output:

490004211265

result:

ok 

Test #17:

score: 0
Accepted
time: 744ms
memory: 250876kb

input:

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

output:

149609988117

result:

ok 

Test #18:

score: 0
Accepted
time: 760ms
memory: 247820kb

input:

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

output:

490004211265

result:

ok 

Test #19:

score: 0
Accepted
time: 756ms
memory: 245452kb

input:

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

output:

1812572240374

result:

ok 

Test #20:

score: 0
Accepted
time: 766ms
memory: 238516kb

input:

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

output:

7322589985203

result:

ok 

Test #21:

score: 0
Accepted
time: 857ms
memory: 256772kb

input:

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

output:

33075374608087

result:

ok 

Test #22:

score: 0
Accepted
time: 852ms
memory: 256676kb

input:

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

output:

6216545751865

result:

ok 

Test #23:

score: 0
Accepted
time: 771ms
memory: 256772kb

input:

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

output:

6090130973914

result:

ok 

Test #24:

score: 0
Accepted
time: 864ms
memory: 256688kb

input:

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

output:

6392103279027

result:

ok 

Test #25:

score: 0
Accepted
time: 1144ms
memory: 269492kb

input:

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

output:

98889219873489

result:

ok 

Test #26:

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

input:

3
0 0 1
1 2
0 2
0

output:

0

result:

ok 

Test #27:

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

input:

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

output:

0

result:

ok 

Test #28:

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

input:

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

output:

0

result:

ok 

Test #29:

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

input:

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

output:

4

result:

ok 

Test #30:

score: 0
Accepted
time: 734ms
memory: 229192kb

input:

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

output:

827878641518

result:

ok 

Test #31:

score: 0
Accepted
time: 722ms
memory: 230188kb

input:

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

output:

148910253102

result:

ok 

Test #32:

score: 0
Accepted
time: 679ms
memory: 229068kb

input:

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

output:

181252557212

result:

ok 

Test #33:

score: 0
Accepted
time: 746ms
memory: 235204kb

input:

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

output:

155843324547

result:

ok 

Test #34:

score: 0
Accepted
time: 246ms
memory: 105708kb

input:

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

output:

0

result:

ok 

Test #35:

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

input:

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

output:

0

result:

ok 

Test #36:

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

input:

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

output:

0

result:

ok 

Test #37:

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

input:

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

output:

598441952

result:

ok 

Subtask #4:

score: 16
Accepted

Test #38:

score: 16
Accepted
time: 2ms
memory: 4096kb

input:

3
1 1 1
0 1
1 2
100
2 0
0 0
0 2
2 1
0 1
0 0
0 1
0 0
1 0
2 2
0 1
0 0
0 1
1 1
0 0
2 0
2 1
2 2
0 2
2 1
2 2
2 0
0 1
2 1
0 2
0 1
2 0
2 1
0 0
2 0
2 1
2 2
0 2
2 0
0 0
2 1
2 0
2 2
1 2
0 1
1 1
2 1
0 0
0 2
0 1
0 0
1 2
1 0
1 2
1 0
0 1
2 2
2 1
2 2
0 2
1 2
2 1
0 0
0 2
0 1
1 1
2 0
0 0
1 2
0 2
0 0
1 0
0 1
0 2
2 1
...

output:

0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
1
0
0
0
1
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0

result:

ok 

Test #39:

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

input:

4
2 2 2 0
0 1
1 2
2 3
100
0 0
3 2
1 1
3 1
0 2
2 0
1 0
3 0
0 1
1 2
0 0
3 2
3 1
1 0
3 2
3 0
3 1
1 2
3 2
0 1
2 2
2 1
1 0
1 1
1 0
3 0
0 2
1 2
0 0
3 1
1 0
2 0
3 0
2 2
3 2
0 2
0 1
3 1
2 1
3 0
1 2
2 2
3 2
2 1
1 1
3 1
1 2
2 0
0 2
1 1
0 1
3 0
2 2
0 2
0 0
1 0
3 1
2 1
0 2
2 2
0 0
0 1
3 0
2 1
1 2
3 1
3 2
1 1
2 ...

output:

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

result:

ok 

Test #40:

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

input:

5
0 1 0 2 1
0 1
1 2
2 3
3 4
100
1 0
4 2
3 1
2 2
2 0
4 1
1 2
3 0
3 2
3 1
1 0
1 2
2 2
4 2
1 1
4 0
2 0
0 2
2 1
0 1
3 2
1 0
4 1
3 0
4 0
3 2
2 0
0 0
2 1
0 2
0 1
4 1
3 0
0 2
4 2
2 0
2 1
4 0
1 2
4 1
1 0
3 2
0 0
2 0
2 2
4 2
3 1
3 0
0 2
1 2
0 0
2 1
3 2
2 0
2 2
0 1
2 0
3 1
0 0
4 0
2 2
1 0
2 1
3 2
4 2
1 1
4 1
...

output:

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

result:

ok 

Test #41:

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

input:

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

output:

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

result:

ok 

Test #42:

score: 0
Accepted
time: 2ms
memory: 4400kb

input:

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

output:

748492
751280
745592
746546
748685
749066
748286
746439
742602
741927
739801
738044
740003
732801
732137
732791
741037
740750
744502
744511
744015
746300
749460
745730
745106
751192
750538
754769
756253
757792
760457
756172
757024
761186
760814
761345
762058
764833
769148
767330
764502
764339
767930...

result:

ok 

Test #43:

score: 0
Accepted
time: 7ms
memory: 7648kb

input:

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

output:

791220194
791202818
791448703
790793734
790538710
790399232
790680228
790274544
789587326
789569532
789589951
789568904
789520169
789458372
789475557
788952064
788936826
788957112
788606079
788625706
788314564
788853784
788476658
788033878
787760817
787604725
787949498
787930696
787950912
787946164
...

result:

ok 

Test #44:

score: 0
Accepted
time: 431ms
memory: 269200kb

input:

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

output:

98878415111108

result:

ok 

Test #45:

score: 0
Accepted
time: 464ms
memory: 269492kb

input:

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

output:

18725807625786

result:

ok 

Test #46:

score: 0
Accepted
time: 312ms
memory: 269284kb

input:

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

output:

19001142419904

result:

ok 

Test #47:

score: 0
Accepted
time: 457ms
memory: 269224kb

input:

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

output:

19038058071323

result:

ok 

Test #48:

score: 0
Accepted
time: 342ms
memory: 131152kb

input:

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

output:

12305851592762
12305852134900
12306133507778
12305866995960
12305585087263
12305866995960
12305585642746
12305866995960
12305585642746
12305866995960
12305585642746
12305583154618
12305582570257
12305583154618
12305864493268
12305582570257
12305583154618
12305864493268
12305863525808
12305581608077
...

result:

ok 

Test #49:

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

input:

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

output:

12301813256756
12302373157130
12301813256756
12302373157130
12302924262596
12302925522835
12302374383909
12302373157130
12301813256756
12302373157130
12302374383909
12301813256756
12302367485243
12302364362222
12302924262596
12302364362222
12302367485243
12301813256756
12302364362222
12302925522835
...

result:

ok 

Test #50:

score: 0
Accepted
time: 395ms
memory: 131152kb

input:

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

output:

12418513167989
12418318171086
12418165193041
12418160409001
12418126763330
12418040055626
12418267377528
12418272506223
12417820448436
12417972199669
12417773522932
12417576059620
12417757013704
12417825430253
12418053743032
12418508820771
12418503688442
12418439828326
12418689699116
12418838558201
...

result:

ok 

Test #51:

score: 0
Accepted
time: 497ms
memory: 131336kb

input:

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

output:

2346723587578
2346797006215
2346772375460
2346809727919
2347690734887
2347721226196
2347677034956
2347711403087
2347703419765
2347769503612
2347741902138
2348263987234
2348275750601
2348310490766
2348282698683
2348245269554
2348276304355
2348288123222
2348310435745
2348929711544
2348877359493
234885...

result:

ok 

Test #52:

score: 0
Accepted
time: 355ms
memory: 131148kb

input:

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

output:

2400462386571
2400462158148
2400461544795
2400461889958
2400461185189
2400461548434
2400461920357
2400461234560
2400460695567
2400460511380
2400459879735
2400460424304
2400460567413
2400460041056
2400459736037
2400459512574
2400459660195
2400459345806
2400575350120
2400575946924
2400575378804
240057...

result:

ok 

Test #53:

score: 0
Accepted
time: 469ms
memory: 131400kb

input:

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

output:

2323745275743
2323777633776
2323806469161
2323833154157
2323840493310
2323808770580
2324765240403
2324758452482
2323776601856
2323753628594
2323785579860
2323750302594
2323802364215
2323774143294
2323758276966
2323764116183
2323699833384
2324252351662
2324767071839
2324755050915
2324753777905
232472...

result:

ok 

Test #54:

score: 0
Accepted
time: 656ms
memory: 269364kb

input:

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

output:

98436910774628
98435790492478
98436353021634
98437473264408
98435641752233
98434521544912
98435641752233
98435650540959
98434527058080
98432660574726
98432663853112
98432964316426
98432961059499
98432964316426
98432961059499
98432964316426
98434084562142
98432964316426
98434084562142
98432873827394
...

result:

ok 

Test #55:

score: 0
Accepted
time: 575ms
memory: 269196kb

input:

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

output:

98656322568720
98654089382763
98656300074379
98654089382763
98656300074379
98654089382763
98656322568720
98656332308779
98654099189422
98656309947638
98656300074379
98654084729795
98656309947638
98656300074379
98654089382763
98651874038179
98654099189422
98654089382763
98654099189422
98656332308779
...

result:

ok 

Test #56:

score: 0
Accepted
time: 940ms
memory: 269280kb

input:

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

output:

98966103892595
98967140571022
98967143550915
98967142609596
98966185678400
98966421102932
98965911821926
98965913407716
98965918104910
98965913417511
98965122079850
98965524762266
98965522367911
98966328834972
98966123179251
98966127823396
98967012540625
98969031950525
98969028633876
98967004001828
...

result:

ok 

Test #57:

score: 0
Accepted
time: 1013ms
memory: 269224kb

input:

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

output:

18697396764912
18695300327400
18695417492428
18695412390750
18695497770485
18695645619754
18695621483891
18695621059672
18695547575010
18695796159440
18697905632033
18697974160176
18697990665232
18698059102482
18700429463664
18700271546880
18700128236136
18700269015812
18700479008398
18700459208097
...

result:

ok 

Test #58:

score: 0
Accepted
time: 767ms
memory: 269364kb

input:

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

output:

19301561644377
19301561010923
19301560519357
19301560658860
19301560141868
19301560283528
19301560403681
19301560821780
19301561367932
19301560929964
19297228945278
19297228845345
19297228942726
19297228773359
19297229163546
19297229516549
19297229611392
19297228960187
19297229206178
19297229572763
...

result:

ok 

Test #59:

score: 0
Accepted
time: 1009ms
memory: 269200kb

input:

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

output:

18631796300984
18631687250817
18631856709119
18631764152424
18631788410608
18631743814247
18631869669973
18631874454986
18631609360317
18633884518788
18633849370968
18633712111542
18633473133941
18633515779302
18633579888709
18633651258564
18633894929986
18634024209976
18634169079793
18634278683400
...

result:

ok 

Subtask #5:

score: 16
Accepted

Test #60:

score: 16
Accepted
time: 1ms
memory: 3764kb

input:

3
2 0 0
0 1
0 2
100
0 1
2 2
2 1
1 1
0 0
2 2
1 2
0 2
0 1
0 0
0 1
0 2
2 1
1 0
2 2
2 0
0 0
0 2
1 1
1 2
2 2
2 1
0 0
2 2
0 1
1 0
0 0
2 0
1 1
1 0
2 1
2 0
0 2
0 1
2 2
1 1
0 0
0 1
2 1
0 0
2 0
0 1
2 1
2 0
0 2
2 2
0 1
2 0
0 0
0 1
2 1
0 2
0 1
0 2
2 2
1 0
1 1
1 2
1 0
1 2
1 0
0 0
1 1
0 1
1 0
2 0
1 2
1 0
0 2
0 0
...

output:

0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0

result:

ok 

Test #61:

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

input:

4
1 0 1 0
0 1
0 2
1 3
100
0 2
3 2
1 1
0 1
3 1
3 2
3 1
2 2
1 2
2 1
1 0
2 2
3 2
3 1
1 1
3 2
2 0
3 1
0 2
1 2
2 1
2 2
0 1
1 0
3 0
3 2
3 1
3 0
0 0
2 0
1 1
1 2
0 1
1 0
2 2
2 1
1 1
3 2
0 0
2 2
0 1
3 1
1 0
2 1
2 0
1 2
0 2
3 0
3 1
0 1
0 2
3 2
3 1
1 1
1 0
2 2
0 0
0 1
0 0
0 1
0 0
2 0
0 1
3 2
0 2
3 0
2 2
2 1
3 ...

output:

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

result:

ok 

Test #62:

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

input:

5
1 0 0 1 1
0 1
0 2
1 3
1 4
100
0 0
0 2
1 1
3 0
3 2
1 0
2 1
0 0
1 2
4 0
0 2
1 0
2 0
1 1
1 0
1 2
3 0
1 0
0 1
0 0
4 1
4 2
3 1
2 1
4 0
3 2
3 1
2 0
2 1
2 0
0 2
2 1
0 0
2 2
1 1
0 2
3 2
4 2
1 2
2 1
0 0
2 0
1 0
0 1
2 2
3 0
3 2
2 0
0 2
1 2
3 1
2 1
4 1
2 2
0 0
0 2
1 0
2 1
4 0
1 2
1 0
1 2
2 0
2 1
0 0
4 1
1 0
...

output:

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

result:

ok 

Test #63:

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

input:

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

output:

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

result:

ok 

Test #64:

score: 0
Accepted
time: 2ms
memory: 4352kb

input:

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

output:

81027
81548
82381
82262
82052
81837
81658
81443
82127
81941
82560
80316
79750
80735
80890
73382
73536
73359
73138
72918
72653
71997
72478
72672
72911
72261
72853
73213
72954
73769
74787
74121
73931
71563
71778
70747
70281
70114
67043
66640
66415
65849
66006
66629
66799
66844
71682
71874
72971
72416
...

result:

ok 

Test #65:

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

input:

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

output:

14132542
14132780
14127197
14127091
14141758
14141687
14141782
14142021
14142204
14134941
14142824
14142974
14140574
14140667
14180192
14184660
14184584
14184417
14184136
14167667
14167744
14167912
14167710
14167788
14174353
14182082
14181898
14186831
14198546
14205957
14196800
14206231
14206053
141...

result:

ok 

Test #66:

score: 0
Accepted
time: 308ms
memory: 229012kb

input:

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

output:

44705759734

result:

ok 

Test #67:

score: 0
Accepted
time: 310ms
memory: 229020kb

input:

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

output:

8081399556

result:

ok 

Test #68:

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

input:

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

output:

7578518269

result:

ok 

Test #69:

score: 0
Accepted
time: 287ms
memory: 228956kb

input:

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

output:

7842611505

result:

ok 

Test #70:

score: 0
Accepted
time: 213ms
memory: 111920kb

input:

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

output:

8821295872
8821296147
9564139052
8821295872
8821295681
9564138785
9564557503
9564371980
8821528877
8821295963
8821273000
8821273290
8821273000
9564071254
8821273290
9564071254
8821273000
8821273290
9564071254
8821273290
8820974722
9563750804
8820974722
8820974425
9563750804
8820974722
8821039686
882...

result:

ok 

Test #71:

score: 0
Accepted
time: 307ms
memory: 111760kb

input:

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

output:

9900828574
9901123105
9901558117
9901559863
9901561538
9901241053
9901243302
9900841539
9901073511
9900841551
9901224707
9900891827
9901193513
9901191456
9900859127
9900508225
9900868272
9900869818
9901103676
9901101160
9901405928
9901403850
9901736004
9902118965
9902402250
9902404114
9902169373
990...

result:

ok 

Test #72:

score: 0
Accepted
time: 307ms
memory: 111760kb

input:

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

output:

8866532903
8866266025
8866265404
8866264491
8865969722
8865968574
8865970233
8866204005
8865029098
8865196570
8865368030
8865370923
8865369538
8865168328
8865135093
8865385470
8865384250
8865383594
8865076149
8865313844
8865546375
8865244496
8864975343
8864974133
8864739724
8864740482
8864739477
886...

result:

ok 

Test #73:

score: 0
Accepted
time: 327ms
memory: 111760kb

input:

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

output:

1923134841
1923098761
1923068781
1923100856
1923136813
1923178461
1923151422
1923190446
1923139511
1923107348
1923142475
1923193068
1922471761
1922501746
1922531560
1922483959
1923074561
1923029924
1922988637
1923039300
1923012232
1923055404
1923709851
1924332573
1924291452
1924336408
1923841979
192...

result:

ok 

Test #74:

score: 0
Accepted
time: 331ms
memory: 111940kb

input:

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

output:

1525082875
1525082664
1525098402
1525098613
1525098402
1525098613
1525098666
1525098457
1530990775
1530990974
1530991108
1530990905
1530990702
1530990737
1530990721
1530990924
1530990945
1530990921
1531653395
1531653190
1531653395
1531653190
1531653147
1531653354
1531653381
1531653176
1531687363
153...

result:

ok 

Test #75:

score: 0
Accepted
time: 328ms
memory: 111772kb

input:

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

output:

2063072176
2063026328
2063571586
2064283826
2064244031
2064284088
2064324207
2063683556
2063638505
2063590631
2063627298
2063648635
2063605542
2063913146
2063956384
2063999436
2063960585
2063923816
2063883884
2063860177
2063893092
2063929914
2064077069
2064034617
2063988435
2064000191
2063960758
206...

result:

ok 

Test #76:

score: 0
Accepted
time: 467ms
memory: 229056kb

input:

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

output:

35803105614
38762344942
38761437962
35802153839
38761437962
38762063367
35802734800
35802734454
38762063367
35802734800
38762063367
38762064512
35802735377
38762064512
38762643916
35803270356
35803270016
38762643916
35803270016
35803268938
38762642614
35803268938
38762642614
35803269286
35803463662
...

result:

ok 

Test #77:

score: 0
Accepted
time: 708ms
memory: 229128kb

input:

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

output:

43444761896
43445433771
43445977597
43445201981
43445746105
43445006762
43445006666
43445724756
43445723551
43445121919
43445841023
43445839953
43445839539
43445839231
43446516618
43447290990
43448075191
43448075302
43447423180
43447834695
43447163589
43447706753
43447705667
43447704670
43446988668
...

result:

ok 

Test #78:

score: 0
Accepted
time: 777ms
memory: 229060kb

input:

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

output:

44897023717
44897026214
44896465355
44896591251
44896593006
44896590513
44895834212
44895368461
44894907040
44895640846
44895212634
44895677125
44894935040
44895723594
44896330327
44896326613
44896856238
44896170213
44895426076
44895423193
44895428090
44895426675
44895786854
44895241240
44894631441
...

result:

ok 

Test #79:

score: 0
Accepted
time: 654ms
memory: 228964kb

input:

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

output:

8101789485
8101739494
8103558728
8103498085
8103578182
8103664670
8103590427
8103512505
8103596589
8103555534
8103628457
8103701618
8103629649
8103726089
8103641305
8103685315
8104669426
8104768182
8104683042
8104599420
8104685426
8104775423
8104866920
8104042681
8103946158
8104045127
8103977963
810...

result:

ok 

Test #80:

score: 0
Accepted
time: 675ms
memory: 229032kb

input:

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

output:

11328642689
11329157196
11329157389
11329157196
11329157003
11329157196
11329157033
11329157228
11329157389
11329157582
11329157338
11329157501
11329157338
11329157143
11329157593
11329157752
11329157481
11329157290
11329157455
11329157266
11329157433
11329157600
11329157785
11329157538
11329157701
...

result:

ok 

Test #81:

score: 0
Accepted
time: 731ms
memory: 229060kb

input:

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

output:

7202374285
7202488860
7202567943
7202610579
7202678643
7203651400
7203653724
7203779776
7203727143
7202795337
7202721296
7202788305
7203614354
7203691259
7203631682
7203564301
7203734098
7203722068
7203783310
7203872538
7203799847
7203858616
7203914809
7203824076
7203876720
7203805758
7203894616
720...

result:

ok 

Subtask #6:

score: 34
Accepted

Dependency #2:

100%
Accepted

Test #82:

score: 34
Accepted
time: 536ms
memory: 138936kb

input:

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

output:

9559281849549
9558726709272
9558729881442
9559281849549
9558726709272
9559281849549
9558729881442
9559281849549
9558729881442
9559281849549
9558726709272
9559281849549
9559183715845
9558884413811
9558329259230
9558343181485
9558898362995
9558346366933
9558349676690
9558901679573
9558349676690
955890...

result:

ok 

Test #83:

score: 0
Accepted
time: 504ms
memory: 138876kb

input:

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

output:

9596047596512
9595616104943
9596053532037
9595619499659
9595182072565
9594755235780
9595189245987
9595616104943
9595622020637
9595188010430
9595625415285
9595192640635
9595619499659
9595613541827
9595619499659
9595192640635
9595625415285
9595619499659
9595182072565
9594755235780
9595192640635
959562...

result:

ok 

Test #84:

score: 0
Accepted
time: 674ms
memory: 138908kb

input:

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

output:

9622694298497
9622741686310
9622812806952
9622385374356
9622418884136
9622421503780
9622420867340
9622420434599
9622420218943
9622422748226
9622422450342
9622422397283
9622169880867
9621998244485
9622205951428
9622011532374
9621602858583
9621832212874
9621831997132
9621807638552
9621958911257
962181...

result:

ok 

Test #85:

score: 0
Accepted
time: 661ms
memory: 138924kb

input:

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

output:

1772658133910
1772639782734
1772648903878
1772618082106
1772649217472
1772697652664
1772731157534
1772763191996
1772788201196
1772800273408
1772798905708
1772762384054
1772809290010
1772773292125
1773433797235
1773430197860
1773394126747
1773373709629
1773409559971
1773427138827
1773429214543
177341...

result:

ok 

Test #86:

score: 0
Accepted
time: 625ms
memory: 139016kb

input:

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

output:

1843753459322
1843753087792
1843752887582
1843753149703
1843753376437
1842907711904
1843928418693
1843928692910
1843928333235
1843928094156
1843927777974
1844670077790
1844669722756
1844670011062
1844670215928
1844670513830
1844670852422
1844670613096
1844670372198
1844670703956
1845582952910
184558...

result:

ok 

Test #87:

score: 0
Accepted
time: 663ms
memory: 139020kb

input:

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

output:

1819509716742
1819523711225
1819540834260
1819553383315
1819563838563
1819562574646
1819526028449
1819557687502
1819582585402
1818769577336
1819313617009
1819342800218
1819342227082
1818768476934
1818743031680
1818772634362
1818804432744
1818844001778
1818826931304
1818865298394
1818825092164
181878...

result:

ok 

Test #88:

score: 0
Accepted
time: 332ms
memory: 120496kb

input:

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

output:

85533161552
85530394278
85527900114
85525331224
85522844128
85525611360
85528304613
85530708556
85530692903
85527908072
85530565223
85533241447
85535788637
85533232941
85533217460
85535938670
85533159843
85530417127
85527677728
85530322861
85533020406
85535709872
85538183615
85536297229
85538975445
...

result:

ok 

Test #89:

score: 0
Accepted
time: 319ms
memory: 120736kb

input:

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

output:

88163490600
88160808346
88160823013
88160806597
88163278177
88160659295
88160650228
88160632339
88158778956
88158767343
88158788337
88156045885
88158477899
88161276306
88163944130
88161470349
88161489759
88158923131
88158900690
88158880553
88156266829
88156277772
88158744340
88156157169
88153483056
...

result:

ok 

Test #90:

score: 0
Accepted
time: 509ms
memory: 122084kb

input:

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

output:

29984838387
29985755560
29985756841
29984806281
29985878178
29986890992
29986890294
29985914110
29985913709
29986824656
29985753613
29986630132
29987705519
29986903166
29987877242
29987878744
29987038858
29986095385
29986094477
29985114036
29985115301
29985918815
29985918476
29985047769
29985952726
...

result:

ok 

Test #91:

score: 0
Accepted
time: 469ms
memory: 120432kb

input:

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

output:

93294755255
93291946437
93291905849
93291930160
93291970148
93288955619
93288998449
93289042651
93289002479
93291744929
93294689769
93294650692
93291768144
93294445662
93291579404
93291617784
93294316936
93291496921
93288670156
93285734973
93283089413
93280296518
93277353657
93277315526
93280162676
...

result:

ok 

Test #92:

score: 0
Accepted
time: 503ms
memory: 118928kb

input:

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

output:

316136684336
316136626565
316136536103
316127639502
316118013463
316107977992
316107913417
316117391225
316107301123
316097347283
316087783495
316087737078
316078110459
316087866540
316077980382
316087308618
316097274857
316088143581
316097797283
316107750466
316107683345
316117437095
316117370809
3...

result:

ok 

Test #93:

score: 0
Accepted
time: 494ms
memory: 115452kb

input:

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

output:

1095656831871
1095619257668
1095618839928
1095588795545
1095554618379
1095554736432
1095589461566
1095589737943
1095624279061
1095623976424
1095624284716
1095598229229
1095568067817
1095567763685
1095568137834
1095568080998
1095602558471
1095568532073
1095534383970
1095567808145
1095567574094
109553...

result:

ok 

Test #94:

score: 0
Accepted
time: 481ms
memory: 125044kb

input:

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

output:

4097865354006
4098331326178
4098516651380
4098050662313
4098049761584
4098050662313
4098516651380
4098050662313
4098516651380
4098050662313
4098516651380
4098050662313
4098516651380
4098049761584
4098050662313
4098142136514
4098141235639
4098608141919
4098142136514
4098238707855
4098237808229
409870...

result:

ok 

Test #95:

score: 0
Accepted
time: 552ms
memory: 125132kb

input:

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

output:

4130152291057
4130056852820
4130179707803
4130180563664
4130181455962
4130294178778
4130174597295
4130298144138
4130393454351
4130394596969
4130393850725
4130488422291
4130372094581
4130372982891
4130512333976
4130606032139
4130484424711
4130485171130
4130485895897
4130611887465
4130730104101
413073...

result:

ok 

Test #96:

score: 0
Accepted
time: 584ms
memory: 124992kb

input:

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

output:

4100962908565
4100510865543
4100607662611
4100487528621
4100488262981
4100865918189
4100866614488
4100865516353
4100866242610
4100728509312
4101187810873
4101062881775
4100692329824
4101011802771
4100762608651
4100761526715
4100630386031
4100765060727
4101084455940
4101085404592
4100706314594
410058...

result:

ok 

Test #97:

score: 0
Accepted
time: 576ms
memory: 125012kb

input:

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

output:

760293049692
760306100439
760263999028
760480245694
760492615292
760480829183
760493497722
760535256365
760557814477
760545556296
760586281642
760572056367
760550639584
760536606475
760715883136
760715172930
760727499627
760745780459
760758584604
760778253175
760830109490
760842444211
760860329576
7...

result:

ok 

Test #98:

score: 0
Accepted
time: 490ms
memory: 125084kb

input:

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

output:

826654004799
826654194674
826654133463
826654181312
826654023514
826653920266
826653733788
826653945959
826654117797
826653908276
826653782514
826653654511
826653600933
826653703960
826653569046
826653403956
826653364326
826653257770
826653422914
826637448595
826637279229
826637350616
826637456619
8...

result:

ok 

Test #99:

score: 0
Accepted
time: 606ms
memory: 125008kb

input:

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

output:

805664825072
805710705933
805723700257
805746319258
805945918968
805738618967
805724576457
806002959191
805989799837
805977031104
806165842730
806385976425
806408592276
806377174159
806363910989
806347226901
806360612288
806338305997
806276355069
806502601984
806516973760
806533700682
806519137461
8...

result:

ok 

Test #100:

score: 0
Accepted
time: 587ms
memory: 131400kb

input:

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

output:

12378861465034
12378861549997
12379137199914
12378861549997
12378861465034
12379137199914
12378861549997
12379137199914
12378861549997
12379137199914
12378861549997
12378861465034
12379137199914
12378861549997
12378861465034
12379137199914
12379139464690
12378863821511
12378861607010
12378861521021
...

result:

ok 

Test #101:

score: 0
Accepted
time: 502ms
memory: 131464kb

input:

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

output:

12356317730902
12355757413015
12355206931832
12355757413015
12356309564939
12355759083756
12356309564939
12355757413015
12356309564939
12356317730902
12355757413015
12355764355718
12356316540921
12355759083756
12356316540921
12355764355718
12355757413015
12355206931832
12355764355718
12356324640326
...

result:

ok 

Test #102:

score: 0
Accepted
time: 693ms
memory: 131168kb

input:

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

output:

12361639333356
12361912035054
12361609273559
12361770767102
12361412299625
12361269172442
12361537499341
12361367443063
12361634309892
12362109703751
12362114355666
12362375712286
12362234785038
12362428752181
12362669907842
12362625781780
12362630221089
12362634525130
12362620483084
12362319321363
...

result:

ok 

Test #103:

score: 0
Accepted
time: 420ms
memory: 113204kb

input:

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

output:

145953829313
146504500096
145953786136
146504500096
145953829313
146504500096
145953786136
146504500096
146498364765
146494865483
145944184844
145944228277
145940137065
146490757708
146487565932
145936961863
145866474549
145866437173
145862282860
146412887959
145862282860
146412887959
145862239383
1...

result:

ok 

Test #104:

score: 0
Accepted
time: 520ms
memory: 114428kb

input:

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

output:

151045518233
151048940412
151048989721
151053526119
151050138354
151050193203
151055666168
151055685648
151051538661
151051501359
151051437434
151055614564
151055562909
151050782917
151045903094
151045858691
151045902613
151050281551
151054706281
151054659497
151051011982
151051038544
151050997994
1...

result:

ok 

Test #105:

score: 0
Accepted
time: 482ms
memory: 113456kb

input:

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

output:

32424642834
32424016637
32423181413
32422521607
32422011030
32421420718
32421975315
32422021723
32421445691
32422124570
32421644969
32437042481
32437981275
32437188280
32437694289
32437234630
32436460553
32435914229
32435762179
32436340401
32437235210
32436735319
32436674155
32436085921
32435406450
...

result:

ok 

Test #106:

score: 0
Accepted
time: 439ms
memory: 113080kb

input:

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

output:

30359891732
30359464977
30359456207
30359468177
30359458176
30359469622
30359249191
30359234680
30359226951
30359218756
30297949108
30297963056
30297968904
30297347234
30297356949
30297345763
30297355160
30297345296
30297358418
30297351515
30297358970
30297347945
30297338878
30297327219
30297318098
...

result:

ok 

Test #107:

score: 0
Accepted
time: 481ms
memory: 113732kb

input:

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

output:

30136609798
30136083207
30136736964
30135867822
30136355770
30136818513
30137497353
30137018626
30137619738
30138121767
30138581832
30138076345
30147341758
30147950560
30147393815
30147136333
30157889347
30161770164
30162347130
30161851147
30154669620
30163331241
30162783461
30162151016
30161255000
...

result:

ok 

Test #108:

score: 0
Accepted
time: 502ms
memory: 113744kb

input:

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

output:

135628486664
135625574730
135621919068
135617830047
135622386052
135623351927
135623329877
135618955253
135614745390
135618471579
135622037033
135625519834
135625536177
135621562312
135617599779
135621889275
135621856312
135626209041
135629696172
135632966938
135629614690
135633710238
135637450477
1...

result:

ok 

Test #109:

score: 0
Accepted
time: 149ms
memory: 54344kb

input:

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

output:

1107046824
0
0
1107046824
0
1107046824
0
1107046824
0
1107046824
0
1107046824
1107013440
1107046824
0
0
1107079985
0
0
1107080208
0
1107080208
0
1107080208
0
0
0
0
0
1107080429
0
0
1107080429
0
0
0
0
0
0
0
1107113592
0
0
0
0
0
0
0
0
0
1107113370
0
0
0
1107113370
1107146532
0
1107146532
0
1107146532
...

result:

ok 

Test #110:

score: 0
Accepted
time: 164ms
memory: 54280kb

input:

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

output:

1110249440
1110282960
1110249837
1110283356
1110250232
1110249837
1110250232
1110217108
1110217500
1110251016
1110217500
1110251016
1110251405
1110251792
1110284920
1110251405
1110217890
1110251016
1110284532
1110318048
1110351176
1110384304
1110383913
1110417432
1110383913
1110384304
1110351176
111...

result:

ok 

Test #111:

score: 0
Accepted
time: 175ms
memory: 54384kb

input:

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

output:

146452258
146455281
146452258
146455281
146458304
146503728
146500704
146497680
146500704
146503728
146500704
146497680
146494656
146497680
146543100
146546125
146549150
146552175
146549150
146552175
146549150
146546125
146543100
146540075
146585492
146588518
146591544
146588518
146585492
146582466
...

result:

ok 

Test #112:

score: 0
Accepted
time: 161ms
memory: 54584kb

input:

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

output:

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

result:

ok 

Test #113:

score: 0
Accepted
time: 156ms
memory: 54276kb

input:

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

output:

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

result:

ok 

Subtask #7:

score: 14
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

100%
Accepted

Dependency #5:

100%
Accepted

Dependency #6:

100%
Accepted

Test #114:

score: 14
Accepted
time: 1287ms
memory: 288064kb

input:

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

output:

76960503493028
76962705274605
76960496001543
76962705274605
76960503493028
76960511516477
76960504028860
76962713300463
76960511516477
76962713300463
76960504028860
76962713300463
76960511516477
76960504028860
76962713300463
76960504028860
76962713300463
76963427687246
76961218470400
76960703082954
...

result:

ok 

Test #115:

score: 0
Accepted
time: 1244ms
memory: 287808kb

input:

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

output:

76935543540291
76935537488010
76937256041318
76937262138072
76937274387699
76935541886938
76933794932586
76935529592622
76935545772484
76935529592622
76935545772484
76937278273461
76937290433696
76935543524040
76937290433696
76935557977408
76937284515266
76935537560921
76937272265653
76935537488010
...

result:

ok 

Test #116:

score: 0
Accepted
time: 1639ms
memory: 287992kb

input:

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

output:

77098179826945
77097160475230
77097151877158
77097142355872
77098127115484
77098115558257
77098508770418
77099479219660
77099491053627
77098924728500
77099711897758
77101370265870
77102509282174
77103297568310
77104480783722
77104488324219
77102768957907
77102754445530
77102761343163
77102768744472
...

result:

ok 

Test #117:

score: 0
Accepted
time: 1610ms
memory: 288084kb

input:

200000
1 1 2 1 1 2 2 2 2 2 1 1 2 1 2 2 2 1 1 2 2 1 2 2 1 2 1 2 1 1 1 2 2 2 2 1 1 1 2 2 1 2 2 1 2 2 1 1 1 2 2 1 1 2 1 2 1 2 2 1 2 2 2 1 2 1 2 1 2 1 2 1 2 2 2 1 2 2 1 2 1 2 2 1 1 2 2 2 1 1 2 1 2 2 1 2 2 2 1 2 2 2 2 2 1 1 2 2 2 1 2 2 2 2 1 1 1 1 1 1 2 1 2 2 1 1 1 2 1 1 1 1 2 1 2 2 1 2 1 1 2 1 2 1 1 1 2...

output:

14641427280749
14641381836999
14641591194363
14641497543753
14641483362104
14641511155079
14641570388439
14641510022907
14641350809134
14641210882912
14641155811205
14643929442862
14644148944958
14644268218401
14644220823868
14644266390275
14644223861826
14644232816038
14642107484961
14642092116823
...

result:

ok 

Test #118:

score: 0
Accepted
time: 1473ms
memory: 287884kb

input:

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

output:

14700180435236
14700180643702
14700180000483
14700180844643
14700180138824
14700180353122
14700179821102
14700179832877
14700178598299
14700177727619
14700178915175
14700179720688
14700178075835
14700178136197
14700178983787
14700179028034
14700178184835
14700177882127
14700179568142
14700181326427
...

result:

ok 

Test #119:

score: 0
Accepted
time: 1675ms
memory: 287708kb

input:

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

output:

14924660353509
14924566776626
14924654123509
14924795231646
14924821348923
14924999108640
14924918976036
14924893049886
14925117321841
14925198818548
14925357392128
14926979829931
14926819101467
14926790950577
14928237544802
14928378120477
14928589989774
14928572888644
14928722898772
14928953023286
...

result:

ok 

Test #120:

score: 0
Accepted
time: 672ms
memory: 247700kb

input:

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

output:

475484584596
475477023035
475484152062
475477055700
475477064773
475469956435
475469950212
475469944726
475469946682
475469944613
475463342423
475470435286
475470428290
475477547103
475484518072
475484507411
475476998094
475469930344
475477285725
475477278377
475477277338
475470645678
475464063517
4...

result:

ok 

Test #121:

score: 0
Accepted
time: 702ms
memory: 247956kb

input:

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

output:

483752269187
483759412576
483759372233
483752770435
483752727101
483760392949
483753119179
483750025195
483757150690
483757125759
483764561983
483764620879
483764597001
483764642347
483756751826
483730608430
483737884777
483737917906
483745468160
483738384762
483731187340
483738262838
483741885665
4...

result:

ok 

Test #122:

score: 0
Accepted
time: 1156ms
memory: 250656kb

input:

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

output:

151195588571
151193220427
151193242852
151193266818
151195675677
151197969505
151197941777
151194956515
151192627987
151192605596
151192629191
151190229704
151190204860
151187695035
151189900095
151189922570
151192017323
151189626992
151189652752
151191947672
151191967387
151194391353
151196815811
1...

result:

ok 

Test #123:

score: 0
Accepted
time: 1200ms
memory: 247724kb

input:

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

output:

483990607797
483998378402
484005066886
483997203628
484004533018
483996631819
484004114303
483997249167
484004324512
484011018768
484011048584
484003707843
484011529570
484011464542
484004077993
483996521147
484003803615
483996564665
484003699483
484010846359
484017982434
484017949359
484017894854
4...

result:

ok 

Test #124:

score: 0
Accepted
time: 1107ms
memory: 245240kb

input:

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

output:

1855157714467
1855157556001
1855186505256
1855186433443
1855186378136
1855158410185
1855130735045
1855102597120
1855131442379
1855104228054
1855104073106
1855075991912
1855048242160
1855048074919
1855021208489
1855021282766
1855049162540
1855077628841
1855049208103
1855077401554
1855048901866
185507...

result:

ok 

Test #125:

score: 0
Accepted
time: 1095ms
memory: 238436kb

input:

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

output:

7307529485570
7307529387202
7307643601427
7307643512474
7307643546517
7307535088962
7307634019184
7307748365449
7307861196229
7307783763173
7307673896781
7307673696550
7307562634559
7307445332859
7307539952845
7307426352138
7307425720589
7307425419432
7307424758921
7307312800339
7307313472183
730742...

result:

ok 

Test #126:

score: 0
Accepted
time: 1044ms
memory: 256912kb

input:

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

output:

32999729069605
32997873228996
32999729069605
32997873228996
32997872862301
32997873228996
32999729069605
32997872862301
32999729069605
32999351222414
32997495048244
32997877487923
32999733693422
32999733411079
32997877567839
32997877207064
32997875079250
32998248153718
32999700464342
33001556640080
...

result:

ok 

Test #127:

score: 0
Accepted
time: 1294ms
memory: 256672kb

input:

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

output:

32861456325372
32861013861538
32861615827163
32862149896541
32862535190798
32862164623372
32861769688595
32861114575110
32861111848014
32861109085196
32861106482925
32861101223443
32861471828796
32861469137504
32861852542189
32862540252483
32862158195377
32861713476328
32861294944212
32861297732044
...

result:

ok 

Test #128:

score: 0
Accepted
time: 1359ms
memory: 256692kb

input:

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

output:

33282420852268
33283159665836
33283637866161
33284195744293
33284193351552
33284641127689
33284632318217
33282817225949
33283330736392
33283332955226
33283779695198
33283355802839
33282186725096
33281785175692
33282226169151
33281686059885
33282247421869
33280860113599
33280863513544
33281212461397
...

result:

ok 

Test #129:

score: 0
Accepted
time: 1335ms
memory: 256768kb

input:

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

output:

6322259063738
6322187486140
6322251539650
6322496078910
6322589973501
6322516448156
6322610352853
6322676031183
6322725777685
6322774613538
6322688771775
6322852085951
6322920509175
6322961072535
6322907640838
6324061815029
6323969073256
6324066029043
6324120345403
6324206759828
6323971946180
632403...

result:

ok 

Test #130:

score: 0
Accepted
time: 1272ms
memory: 256916kb

input:

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

output:

6522993991132
6522994060596
6522994124631
6522994180414
6522994201015
6522994150693
6522993936177
6522993909176
6522993997076
6522993957295
6522994031775
6522993971974
6522993743632
6522900660980
6522900626512
6522900559849
6522900473095
6522900530729
6522900511060
6522900425916
6522900471179
652290...

result:

ok 

Test #131:

score: 0
Accepted
time: 1342ms
memory: 256784kb

input:

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

output:

6276993767048
6276925801827
6276976272394
6276923695700
6276972153298
6278076897664
6278142305903
6278221454177
6278168039783
6278216526363
6278460692025
6278536149264
6278776916695
6278726666525
6278681616016
6278629405493
6278483344231
6278353766319
6278268111665
6278116224342
6278197637027
627812...

result:

ok 

Test #132:

score: 0
Accepted
time: 1376ms
memory: 269276kb

input:

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

output:

98591152363406
98591158840501
98592257209933
98592998106969
98591899793346
98591552522091
98592650791046
98591638788396
98590534049112
98591071047322
98591077517259
98591071047322
98592175734025
98591071047322
98591077517259
98591071047322
98591077517259
98591071047322
98591077517259
98590375103441
...

result:

ok 

Test #133:

score: 0
Accepted
time: 1285ms
memory: 269432kb

input:

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

output:

98537318743601
98535093891840
98537318743601
98537308851883
98539521246522
98537306220079
98537312658997
98539537577158
98539527619040
98537312658997
98539537577158
98537318743601
98537308851883
98537318743601
98537308851883
98539521246522
98537306220079
98539521246522
98539527619040
98539537577158
...

result:

ok 

Test #134:

score: 0
Accepted
time: 1691ms
memory: 269368kb

input:

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

output:

98949912785464
98949866297414
98949873005319
98949869791396
98950641034160
98949567782126
98950561050083
98951997956523
98950883849696
98951931710610
98952098745662
98952103171320
98951034169978
98951026849914
98950321784690
98950313905247
98950943350186
98948950244151
98949332741811
98949871266016
...

result:

ok 

Test #135:

score: 0
Accepted
time: 935ms
memory: 233092kb

input:

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

output:

694221705821
697096843216
697109844365
697109709618
694234611111
697109709618
694234611111
697109709618
694234532147
697109709618
694234532147
694226657855
694226736766
694226870247
694218569824
694207709836
697082687383
694207631108
694197098627
697072113995
694197177267
694204360137
694204281517
6...

result:

ok 

Test #136:

score: 0
Accepted
time: 1115ms
memory: 229976kb

input:

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

output:

774783460710
774796156681
774786005675
774770452662
774784963274
774784885329
774772673424
774787097419
774787055580
774800669037
774787334633
774787262298
774787111280
774777535385
774777458561
774767544911
774767633506
774754818327
774766432805
774777926427
774764661997
774776413138
774776453471
7...

result:

ok 

Test #137:

score: 0
Accepted
time: 1166ms
memory: 238392kb

input:

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

output:

172284391184
172282557032
172312660973
172347151659
172348877742
172379542459
172380938008
172382416414
172383824648
172382557220
172384430967
172386459027
172387864596
172389232793
172391435358
172393128113
172391545802
172389453203
172387651689
172415558212
172414019001
172415383475
172413425280
1...

result:

ok 

Test #138:

score: 0
Accepted
time: 995ms
memory: 228584kb

input:

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

output:

143694198034
143694181771
143692828575
143692824890
143692821843
143691067445
143691074047
143691077533
143691067383
143691071139
143691074199
143691086559
143691095272
143691091712
143691082951
143691079259
143689969506
143691398854
143691403231
143691409524
143691397375
143689780198
143689791946
1...

result:

ok 

Test #139:

score: 0
Accepted
time: 1047ms
memory: 230712kb

input:

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

output:

150925283170
150926850691
150927945877
150926828879
150925413496
150924114556
150926147195
150928060454
150929785988
150931963492
150913974116
150915933915
150936958390
150956211943
150958072739
150956511900
150983388856
150984437489
151006289631
151007884536
151009242131
151007631535
151007248035
1...

result:

ok 

Test #140:

score: 0
Accepted
time: 1081ms
memory: 229472kb

input:

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

output:

830948961894
830962691438
831089845804
831089777358
831103120890
831197150672
831207599421
831221036762
831238052959
831237947892
831228231087
831214453918
831200087238
831189163468
831179655054
831179714624
831166692113
831176318663
831188756291
831178154962
831178088610
831177966609
831178059867
8...

result:

ok 

Test #141:

score: 0
Accepted
time: 320ms
memory: 105684kb

input:

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

output:

4444780818
0
4444780818
0
0
4444780410
0
0
0
0
4444580199
0
0
0
4444513736
0
4444513736
4444514144
0
0
0
4444448085
0
4444448085
0
0
4444448488
0
4444448488
0
4444448488
4444515356
0
4444515356
0
4444515356
4444582224
0
0
4444582224
0
4444582224
0
0
0
4444582224
0
4444582224
0
0
0
0
0
4444648290
0
4...

result:

ok 

Test #142:

score: 0
Accepted
time: 371ms
memory: 105896kb

input:

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

output:

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

result:

ok 

Test #143:

score: 0
Accepted
time: 333ms
memory: 105644kb

input:

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

output:

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

result:

ok 

Test #144:

score: 0
Accepted
time: 365ms
memory: 105532kb

input:

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

output:

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

result:

ok 

Test #145:

score: 0
Accepted
time: 340ms
memory: 105836kb

input:

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

output:

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

result:

ok 

Extra Test:

score: 0
Extra Test Passed