Submission #1099841

# Submission time Handle Problem Language Result Execution time Memory
1099841 2024-10-12T05:34:46 Z model_code Hieroglyphs (IOI24_hieroglyphs) C++17
100 / 100
147 ms 20356 KB
// model_solution/felix-full-alternative.cpp

#include<bits/stdc++.h>
#include "hieroglyphs.h"

using namespace std;

using vi = vector<int>;
using vvi = vector<vi>;
using ii = pair<int, int>;

const int ALPHABET_SIZE = 200001;

bool is_subsequence(const vi& a, const vi& b) {
    int j = 0;
    for (int x : a) {
        if (j < (int)b.size() && b[j] == x) {
            j++;
        }
    }
    return j == (int)b.size();
}

vi get_candidate(const vi& a, const vi& b) {
    int n = a.size();
    int m = b.size();

    vi occ_a(ALPHABET_SIZE, 0);
    vi occ_b(ALPHABET_SIZE, 0);
    for (int i=0; i < n; ++i) {
        occ_a[a[i]]++;
    }
    for (int i=0; i < m; ++i) {
        occ_b[b[i]]++;
    }

    vi c;
    queue<int> qa;
    queue<int> qb;

    for (int i=0; i < n; ++i) {
        if (occ_a[a[i]] <= occ_b[a[i]]) {
            qa.push(i);
        }
    }
    for (int i=0; i < m; ++i) {
        if (occ_a[b[i]] > occ_b[b[i]]) {
            qb.push(i);
        }
    }

    int i_a_curr = 0;
    int i_b_curr = 0;
    int i_a_next = 0;
    int i_b_next = 0;
    vi occ_a_curr = vi(occ_a);
    vi occ_a_next = vi(occ_a);
    vi occ_b_curr = vi(occ_b);
    vi occ_b_next = vi(occ_b);

    while(!qa.empty() && !qb.empty()) {
        while(i_a_next < qa.front()) {
            occ_a_next[a[i_a_next]]--;
            i_a_next++;
        }
        while(i_b_next < qb.front()) {
            occ_b_next[b[i_b_next]]--;
            i_b_next++;
        }

        int x = a[i_a_next];
        int y = b[i_b_next];

        int occ_x = occ_a_next[x];
        int occ_y = occ_b_next[y];

        bool a_good = (occ_a_next[y] >= occ_y && occ_b_curr[x] > occ_b_next[x]);
        bool b_good = (occ_b_next[x] >= occ_x && occ_a_curr[y] > occ_a_next[y]);

        if (a_good && b_good) return {-1};
        if (!a_good && !b_good) return {-1};

        if(a_good) {
            c.push_back(x);
            qa.pop();
            while(i_a_curr <= i_a_next) {
                occ_a_curr[a[i_a_curr]]--;
                i_a_curr++;
            }
            while(b[i_b_curr] != x) {
                occ_b_curr[b[i_b_curr]]--;
                i_b_curr++;
            }
            occ_b_curr[b[i_b_curr]]--;
            i_b_curr++;
        }
        else {
            c.push_back(y);
            qb.pop();
            while(i_b_curr <= i_b_next) {
                occ_b_curr[b[i_b_curr]]--;
                i_b_curr++;
            }
            while(a[i_a_curr] != y) {
                occ_a_curr[a[i_a_curr]]--;
                i_a_curr++;
            }
            occ_a_curr[a[i_a_curr]]--;
            i_a_curr++;
        }
    }

    while(!qa.empty()) {
        c.push_back(a[qa.front()]);
        qa.pop();
    }
    while(!qb.empty()) {
        c.push_back(b[qb.front()]);
        qb.pop();
    }

    return ((is_subsequence(a, c) && is_subsequence(b, c)) ? c : vi({-1}));
}

vi index_vector(const vi& a, const vi& b) {
    int n = a.size();
    int m = b.size();
    vi v(m);
    vi prev_occ_b(ALPHABET_SIZE, -1);
    vvi a_occ(ALPHABET_SIZE);
    for (int i=0; i < n; ++i) {
        a_occ[a[i]].push_back(i);
    }
    for (int i=0; i < ALPHABET_SIZE; ++i) {
        a_occ[i].push_back(n);
    }
    vector<ii> min_stack;
    for (int i=0; i < m; ++i) {
        if (prev_occ_b[b[i]] == -1) {
            v[i] = a_occ[b[i]][0];
        }
        else {
            int min_val = lower_bound(min_stack.begin(), min_stack.end(), ii(prev_occ_b[b[i]], -1))->second;
            if (min_val < n) v[i] = *lower_bound(a_occ[b[i]].begin(), a_occ[b[i]].end(), min_val+1);
            else v[i] = n;
        }
        while(!min_stack.empty() && min_stack.back().second >= v[i]) {
            min_stack.pop_back();
        }
        min_stack.emplace_back(i, v[i]);
        prev_occ_b[b[i]] = i;
    }
    return v; 
}

vi reverse_index_vector(vi a, vi b) {
    int n = a.size();
    reverse(a.begin(), a.end());
    reverse(b.begin(), b.end());
    vi v = index_vector(a, b);
    reverse(v.begin(), v.end());
    for (int& x : v) x = n-1-x;
    return v; 
}

bool verify(const vi& a, const vi& b, const vi& c) {
    if (c == vi({-1})) return false;
    if (c == vi()) return true; 
    int n = a.size();
    int m = b.size();
    int l = c.size();

    vi occ_a(ALPHABET_SIZE, 0);
    vi occ_b(ALPHABET_SIZE, 0);
    for (int i=0; i < n; ++i) {
        occ_a[a[i]]++;
    }
    for (int i=0; i < m; ++i) {
        occ_b[b[i]]++;
    }

    vi iva = index_vector(a, c);
    vi ivb = index_vector(b, c);
    vi riva = reverse_index_vector(a, c);
    vi rivb = reverse_index_vector(b, c);

    int cai = 0;
    int cbi = 0;
    vector<ii> a_stack;
    vector<ii> b_stack;

    for (int i=0; i < l; ++i) {
        if (occ_a[c[i]] <= occ_b[c[i]]) {
            while (a[cai] != c[i]) cai++;

            while (!a_stack.empty() && a_stack.back().second <= rivb[i]) a_stack.pop_back();
            a_stack.emplace_back(cai, rivb[i]);

            while (!b_stack.empty() && b_stack.back().second < cai) b_stack.pop_back();
            if (!b_stack.empty() && b_stack.back().first > ivb[i]) {
                return false;
            }

            cai++;
        }
        else {
            while (b[cbi] != c[i]) cbi++;

            while (!b_stack.empty() && b_stack.back().second <= riva[i]) b_stack.pop_back();
            b_stack.emplace_back(cbi, riva[i]);

            while (!a_stack.empty() && a_stack.back().second < cbi) a_stack.pop_back();
            if (!a_stack.empty() && a_stack.back().first > iva[i]) {
                return false;
            }

            cbi++;
        }
    }
    return true;
}

vector<int> ucs(vector<int> a, vector<int> b) {
    vi c = get_candidate(a, b);
    if (verify(a, b, c)) return c;
    return {-1};
}
# Verdict Execution time Memory Grader output
1 Correct 34 ms 13736 KB Output is correct
2 Correct 3 ms 4952 KB Output is correct
3 Correct 2 ms 4952 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 31 ms 13772 KB Output is correct
2 Correct 2 ms 4956 KB Output is correct
3 Correct 38 ms 13684 KB Output is correct
4 Correct 2 ms 4956 KB Output is correct
5 Correct 88 ms 19760 KB Output is correct
6 Correct 16 ms 7636 KB Output is correct
7 Correct 18 ms 7640 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 31 ms 13772 KB Output is correct
2 Correct 2 ms 4956 KB Output is correct
3 Correct 38 ms 13684 KB Output is correct
4 Correct 2 ms 4956 KB Output is correct
5 Correct 88 ms 19760 KB Output is correct
6 Correct 16 ms 7636 KB Output is correct
7 Correct 18 ms 7640 KB Output is correct
8 Correct 86 ms 16892 KB Output is correct
9 Correct 90 ms 16692 KB Output is correct
10 Correct 101 ms 16688 KB Output is correct
11 Correct 82 ms 16892 KB Output is correct
12 Correct 86 ms 17964 KB Output is correct
13 Correct 81 ms 17716 KB Output is correct
14 Correct 82 ms 17712 KB Output is correct
15 Correct 80 ms 17660 KB Output is correct
16 Correct 87 ms 17660 KB Output is correct
17 Correct 81 ms 17668 KB Output is correct
18 Correct 34 ms 13736 KB Output is correct
19 Correct 34 ms 13736 KB Output is correct
20 Correct 35 ms 13740 KB Output is correct
21 Correct 37 ms 13816 KB Output is correct
22 Correct 60 ms 15964 KB Output is correct
23 Correct 88 ms 17508 KB Output is correct
24 Correct 89 ms 17272 KB Output is correct
25 Correct 84 ms 17524 KB Output is correct
26 Correct 79 ms 16192 KB Output is correct
27 Correct 88 ms 16692 KB Output is correct
28 Correct 94 ms 16656 KB Output is correct
29 Correct 84 ms 16688 KB Output is correct
30 Correct 81 ms 16696 KB Output is correct
31 Correct 82 ms 16692 KB Output is correct
32 Correct 87 ms 16688 KB Output is correct
33 Correct 85 ms 16692 KB Output is correct
34 Correct 72 ms 16492 KB Output is correct
35 Correct 88 ms 17456 KB Output is correct
36 Correct 87 ms 17336 KB Output is correct
37 Correct 101 ms 17484 KB Output is correct
38 Correct 82 ms 17456 KB Output is correct
39 Correct 91 ms 17460 KB Output is correct
40 Correct 85 ms 17472 KB Output is correct
41 Correct 107 ms 17456 KB Output is correct
42 Correct 79 ms 17452 KB Output is correct
43 Correct 117 ms 17528 KB Output is correct
44 Correct 76 ms 17412 KB Output is correct
45 Correct 87 ms 17196 KB Output is correct
46 Correct 78 ms 17712 KB Output is correct
47 Correct 79 ms 17712 KB Output is correct
48 Correct 76 ms 17412 KB Output is correct
49 Correct 73 ms 17196 KB Output is correct
50 Correct 80 ms 17712 KB Output is correct
51 Correct 81 ms 17716 KB Output is correct
52 Correct 112 ms 17712 KB Output is correct
53 Correct 77 ms 17712 KB Output is correct
54 Correct 81 ms 17456 KB Output is correct
55 Correct 83 ms 17728 KB Output is correct
56 Correct 82 ms 17612 KB Output is correct
57 Correct 81 ms 17172 KB Output is correct
58 Correct 116 ms 17200 KB Output is correct
59 Correct 84 ms 17016 KB Output is correct
60 Correct 93 ms 16936 KB Output is correct
61 Correct 82 ms 16940 KB Output is correct
62 Correct 88 ms 16880 KB Output is correct
63 Correct 78 ms 17112 KB Output is correct
64 Correct 90 ms 17068 KB Output is correct
65 Correct 76 ms 16944 KB Output is correct
66 Correct 93 ms 16900 KB Output is correct
67 Correct 92 ms 16940 KB Output is correct
68 Correct 76 ms 16944 KB Output is correct
69 Correct 2 ms 4956 KB Output is correct
70 Correct 62 ms 13724 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 95 ms 20344 KB Output is correct
2 Correct 111 ms 20356 KB Output is correct
3 Correct 66 ms 18272 KB Output is correct
4 Correct 68 ms 18028 KB Output is correct
5 Correct 108 ms 19892 KB Output is correct
6 Correct 46 ms 15768 KB Output is correct
7 Correct 33 ms 13732 KB Output is correct
8 Correct 31 ms 13736 KB Output is correct
9 Correct 32 ms 13740 KB Output is correct
10 Correct 55 ms 13692 KB Output is correct
11 Correct 34 ms 13736 KB Output is correct
12 Correct 2 ms 4956 KB Output is correct
13 Correct 2 ms 4956 KB Output is correct
14 Correct 33 ms 13736 KB Output is correct
15 Correct 3 ms 4956 KB Output is correct
16 Correct 84 ms 19384 KB Output is correct
17 Correct 14 ms 7260 KB Output is correct
18 Correct 57 ms 17460 KB Output is correct
19 Correct 12 ms 6516 KB Output is correct
20 Correct 65 ms 18664 KB Output is correct
21 Correct 23 ms 6736 KB Output is correct
22 Correct 12 ms 7004 KB Output is correct
23 Correct 65 ms 19560 KB Output is correct
24 Correct 63 ms 20352 KB Output is correct
25 Correct 15 ms 7636 KB Output is correct
26 Correct 65 ms 20188 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 86 ms 16892 KB Output is correct
2 Correct 90 ms 16692 KB Output is correct
3 Correct 101 ms 16688 KB Output is correct
4 Correct 82 ms 16892 KB Output is correct
5 Correct 86 ms 17964 KB Output is correct
6 Correct 81 ms 17716 KB Output is correct
7 Correct 82 ms 17712 KB Output is correct
8 Correct 80 ms 17660 KB Output is correct
9 Correct 87 ms 17660 KB Output is correct
10 Correct 81 ms 17668 KB Output is correct
11 Correct 34 ms 13736 KB Output is correct
12 Correct 34 ms 13736 KB Output is correct
13 Correct 35 ms 13740 KB Output is correct
14 Correct 37 ms 13816 KB Output is correct
15 Correct 60 ms 15964 KB Output is correct
16 Correct 88 ms 17508 KB Output is correct
17 Correct 89 ms 17272 KB Output is correct
18 Correct 84 ms 17524 KB Output is correct
19 Correct 79 ms 16192 KB Output is correct
20 Correct 95 ms 20344 KB Output is correct
21 Correct 111 ms 20356 KB Output is correct
22 Correct 66 ms 18272 KB Output is correct
23 Correct 68 ms 18028 KB Output is correct
24 Correct 108 ms 19892 KB Output is correct
25 Correct 46 ms 15768 KB Output is correct
26 Correct 34 ms 13820 KB Output is correct
27 Correct 35 ms 13832 KB Output is correct
28 Correct 47 ms 13820 KB Output is correct
29 Correct 37 ms 13820 KB Output is correct
30 Correct 33 ms 13820 KB Output is correct
31 Correct 34 ms 13820 KB Output is correct
32 Correct 38 ms 13816 KB Output is correct
33 Correct 40 ms 13896 KB Output is correct
34 Correct 50 ms 15228 KB Output is correct
35 Correct 102 ms 19784 KB Output is correct
36 Correct 114 ms 19936 KB Output is correct
37 Correct 106 ms 20144 KB Output is correct
38 Correct 93 ms 20288 KB Output is correct
39 Correct 91 ms 20316 KB Output is correct
40 Correct 106 ms 16996 KB Output is correct
41 Correct 89 ms 17504 KB Output is correct
42 Correct 57 ms 16096 KB Output is correct
43 Correct 75 ms 16140 KB Output is correct
44 Correct 61 ms 16404 KB Output is correct
45 Correct 81 ms 16420 KB Output is correct
46 Correct 83 ms 17012 KB Output is correct
47 Correct 86 ms 16680 KB Output is correct
48 Correct 81 ms 16460 KB Output is correct
49 Correct 86 ms 17292 KB Output is correct
50 Correct 92 ms 16776 KB Output is correct
51 Correct 94 ms 16776 KB Output is correct
52 Correct 89 ms 16760 KB Output is correct
53 Correct 88 ms 16760 KB Output is correct
54 Correct 128 ms 16784 KB Output is correct
55 Correct 52 ms 15276 KB Output is correct
56 Correct 104 ms 19712 KB Output is correct
57 Correct 98 ms 18644 KB Output is correct
58 Correct 110 ms 19852 KB Output is correct
59 Correct 147 ms 19392 KB Output is correct
60 Correct 119 ms 18732 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 33 ms 13732 KB Output is correct
2 Correct 31 ms 13736 KB Output is correct
3 Correct 32 ms 13740 KB Output is correct
4 Correct 55 ms 13692 KB Output is correct
5 Correct 34 ms 13736 KB Output is correct
6 Correct 2 ms 4956 KB Output is correct
7 Correct 2 ms 4956 KB Output is correct
8 Correct 33 ms 13736 KB Output is correct
9 Correct 3 ms 4956 KB Output is correct
10 Correct 34 ms 13820 KB Output is correct
11 Correct 35 ms 13832 KB Output is correct
12 Correct 47 ms 13820 KB Output is correct
13 Correct 37 ms 13820 KB Output is correct
14 Correct 33 ms 13820 KB Output is correct
15 Correct 34 ms 13820 KB Output is correct
16 Correct 38 ms 13816 KB Output is correct
17 Correct 40 ms 13896 KB Output is correct
18 Correct 33 ms 13820 KB Output is correct
19 Correct 41 ms 13832 KB Output is correct
20 Correct 58 ms 13820 KB Output is correct
21 Correct 47 ms 13868 KB Output is correct
22 Correct 57 ms 13844 KB Output is correct
23 Correct 41 ms 13816 KB Output is correct
24 Correct 57 ms 13832 KB Output is correct
25 Correct 38 ms 13780 KB Output is correct
26 Correct 34 ms 13928 KB Output is correct
27 Correct 36 ms 13808 KB Output is correct
28 Correct 44 ms 13836 KB Output is correct
29 Correct 47 ms 13816 KB Output is correct
30 Correct 41 ms 13816 KB Output is correct
31 Correct 38 ms 13924 KB Output is correct
32 Correct 38 ms 13908 KB Output is correct
33 Correct 41 ms 13740 KB Output is correct
34 Correct 37 ms 13720 KB Output is correct
35 Correct 38 ms 13648 KB Output is correct
36 Correct 40 ms 13816 KB Output is correct
37 Correct 53 ms 13764 KB Output is correct
38 Correct 59 ms 13820 KB Output is correct
39 Correct 40 ms 13816 KB Output is correct
40 Correct 61 ms 13732 KB Output is correct
41 Correct 37 ms 13776 KB Output is correct
42 Correct 41 ms 13880 KB Output is correct
43 Correct 42 ms 13824 KB Output is correct
44 Correct 43 ms 13884 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 34 ms 13736 KB Output is correct
2 Correct 3 ms 4952 KB Output is correct
3 Correct 2 ms 4952 KB Output is correct
4 Correct 31 ms 13772 KB Output is correct
5 Correct 2 ms 4956 KB Output is correct
6 Correct 38 ms 13684 KB Output is correct
7 Correct 2 ms 4956 KB Output is correct
8 Correct 88 ms 19760 KB Output is correct
9 Correct 16 ms 7636 KB Output is correct
10 Correct 18 ms 7640 KB Output is correct
11 Correct 86 ms 16892 KB Output is correct
12 Correct 90 ms 16692 KB Output is correct
13 Correct 101 ms 16688 KB Output is correct
14 Correct 82 ms 16892 KB Output is correct
15 Correct 86 ms 17964 KB Output is correct
16 Correct 81 ms 17716 KB Output is correct
17 Correct 82 ms 17712 KB Output is correct
18 Correct 80 ms 17660 KB Output is correct
19 Correct 87 ms 17660 KB Output is correct
20 Correct 81 ms 17668 KB Output is correct
21 Correct 34 ms 13736 KB Output is correct
22 Correct 34 ms 13736 KB Output is correct
23 Correct 35 ms 13740 KB Output is correct
24 Correct 37 ms 13816 KB Output is correct
25 Correct 60 ms 15964 KB Output is correct
26 Correct 88 ms 17508 KB Output is correct
27 Correct 89 ms 17272 KB Output is correct
28 Correct 84 ms 17524 KB Output is correct
29 Correct 79 ms 16192 KB Output is correct
30 Correct 88 ms 16692 KB Output is correct
31 Correct 94 ms 16656 KB Output is correct
32 Correct 84 ms 16688 KB Output is correct
33 Correct 81 ms 16696 KB Output is correct
34 Correct 82 ms 16692 KB Output is correct
35 Correct 87 ms 16688 KB Output is correct
36 Correct 85 ms 16692 KB Output is correct
37 Correct 72 ms 16492 KB Output is correct
38 Correct 88 ms 17456 KB Output is correct
39 Correct 87 ms 17336 KB Output is correct
40 Correct 101 ms 17484 KB Output is correct
41 Correct 82 ms 17456 KB Output is correct
42 Correct 91 ms 17460 KB Output is correct
43 Correct 85 ms 17472 KB Output is correct
44 Correct 107 ms 17456 KB Output is correct
45 Correct 79 ms 17452 KB Output is correct
46 Correct 117 ms 17528 KB Output is correct
47 Correct 76 ms 17412 KB Output is correct
48 Correct 87 ms 17196 KB Output is correct
49 Correct 78 ms 17712 KB Output is correct
50 Correct 79 ms 17712 KB Output is correct
51 Correct 76 ms 17412 KB Output is correct
52 Correct 73 ms 17196 KB Output is correct
53 Correct 80 ms 17712 KB Output is correct
54 Correct 81 ms 17716 KB Output is correct
55 Correct 112 ms 17712 KB Output is correct
56 Correct 77 ms 17712 KB Output is correct
57 Correct 81 ms 17456 KB Output is correct
58 Correct 83 ms 17728 KB Output is correct
59 Correct 82 ms 17612 KB Output is correct
60 Correct 81 ms 17172 KB Output is correct
61 Correct 116 ms 17200 KB Output is correct
62 Correct 84 ms 17016 KB Output is correct
63 Correct 93 ms 16936 KB Output is correct
64 Correct 82 ms 16940 KB Output is correct
65 Correct 88 ms 16880 KB Output is correct
66 Correct 78 ms 17112 KB Output is correct
67 Correct 90 ms 17068 KB Output is correct
68 Correct 76 ms 16944 KB Output is correct
69 Correct 93 ms 16900 KB Output is correct
70 Correct 92 ms 16940 KB Output is correct
71 Correct 76 ms 16944 KB Output is correct
72 Correct 2 ms 4956 KB Output is correct
73 Correct 62 ms 13724 KB Output is correct
74 Correct 95 ms 20344 KB Output is correct
75 Correct 111 ms 20356 KB Output is correct
76 Correct 66 ms 18272 KB Output is correct
77 Correct 68 ms 18028 KB Output is correct
78 Correct 108 ms 19892 KB Output is correct
79 Correct 46 ms 15768 KB Output is correct
80 Correct 33 ms 13732 KB Output is correct
81 Correct 31 ms 13736 KB Output is correct
82 Correct 32 ms 13740 KB Output is correct
83 Correct 55 ms 13692 KB Output is correct
84 Correct 34 ms 13736 KB Output is correct
85 Correct 2 ms 4956 KB Output is correct
86 Correct 2 ms 4956 KB Output is correct
87 Correct 33 ms 13736 KB Output is correct
88 Correct 3 ms 4956 KB Output is correct
89 Correct 84 ms 19384 KB Output is correct
90 Correct 14 ms 7260 KB Output is correct
91 Correct 57 ms 17460 KB Output is correct
92 Correct 12 ms 6516 KB Output is correct
93 Correct 65 ms 18664 KB Output is correct
94 Correct 23 ms 6736 KB Output is correct
95 Correct 12 ms 7004 KB Output is correct
96 Correct 65 ms 19560 KB Output is correct
97 Correct 63 ms 20352 KB Output is correct
98 Correct 15 ms 7636 KB Output is correct
99 Correct 65 ms 20188 KB Output is correct
100 Correct 34 ms 13820 KB Output is correct
101 Correct 35 ms 13832 KB Output is correct
102 Correct 47 ms 13820 KB Output is correct
103 Correct 37 ms 13820 KB Output is correct
104 Correct 33 ms 13820 KB Output is correct
105 Correct 34 ms 13820 KB Output is correct
106 Correct 38 ms 13816 KB Output is correct
107 Correct 40 ms 13896 KB Output is correct
108 Correct 50 ms 15228 KB Output is correct
109 Correct 102 ms 19784 KB Output is correct
110 Correct 114 ms 19936 KB Output is correct
111 Correct 106 ms 20144 KB Output is correct
112 Correct 93 ms 20288 KB Output is correct
113 Correct 91 ms 20316 KB Output is correct
114 Correct 106 ms 16996 KB Output is correct
115 Correct 89 ms 17504 KB Output is correct
116 Correct 57 ms 16096 KB Output is correct
117 Correct 75 ms 16140 KB Output is correct
118 Correct 61 ms 16404 KB Output is correct
119 Correct 81 ms 16420 KB Output is correct
120 Correct 83 ms 17012 KB Output is correct
121 Correct 86 ms 16680 KB Output is correct
122 Correct 81 ms 16460 KB Output is correct
123 Correct 86 ms 17292 KB Output is correct
124 Correct 92 ms 16776 KB Output is correct
125 Correct 94 ms 16776 KB Output is correct
126 Correct 89 ms 16760 KB Output is correct
127 Correct 88 ms 16760 KB Output is correct
128 Correct 128 ms 16784 KB Output is correct
129 Correct 52 ms 15276 KB Output is correct
130 Correct 104 ms 19712 KB Output is correct
131 Correct 98 ms 18644 KB Output is correct
132 Correct 110 ms 19852 KB Output is correct
133 Correct 147 ms 19392 KB Output is correct
134 Correct 119 ms 18732 KB Output is correct
135 Correct 33 ms 13820 KB Output is correct
136 Correct 41 ms 13832 KB Output is correct
137 Correct 58 ms 13820 KB Output is correct
138 Correct 47 ms 13868 KB Output is correct
139 Correct 57 ms 13844 KB Output is correct
140 Correct 41 ms 13816 KB Output is correct
141 Correct 57 ms 13832 KB Output is correct
142 Correct 38 ms 13780 KB Output is correct
143 Correct 34 ms 13928 KB Output is correct
144 Correct 36 ms 13808 KB Output is correct
145 Correct 44 ms 13836 KB Output is correct
146 Correct 47 ms 13816 KB Output is correct
147 Correct 41 ms 13816 KB Output is correct
148 Correct 38 ms 13924 KB Output is correct
149 Correct 38 ms 13908 KB Output is correct
150 Correct 41 ms 13740 KB Output is correct
151 Correct 37 ms 13720 KB Output is correct
152 Correct 38 ms 13648 KB Output is correct
153 Correct 40 ms 13816 KB Output is correct
154 Correct 53 ms 13764 KB Output is correct
155 Correct 59 ms 13820 KB Output is correct
156 Correct 40 ms 13816 KB Output is correct
157 Correct 61 ms 13732 KB Output is correct
158 Correct 37 ms 13776 KB Output is correct
159 Correct 41 ms 13880 KB Output is correct
160 Correct 42 ms 13824 KB Output is correct
161 Correct 43 ms 13884 KB Output is correct
162 Correct 127 ms 19224 KB Output is correct
163 Correct 65 ms 13828 KB Output is correct
164 Correct 44 ms 14252 KB Output is correct
165 Correct 56 ms 14716 KB Output is correct
166 Correct 67 ms 15080 KB Output is correct
167 Correct 74 ms 16040 KB Output is correct
168 Correct 30 ms 6620 KB Output is correct
169 Correct 58 ms 16128 KB Output is correct
170 Correct 65 ms 16464 KB Output is correct
171 Correct 53 ms 16288 KB Output is correct
172 Correct 38 ms 14344 KB Output is correct
173 Correct 37 ms 14332 KB Output is correct
174 Correct 52 ms 14304 KB Output is correct
175 Correct 44 ms 14156 KB Output is correct
176 Correct 37 ms 14088 KB Output is correct
177 Correct 61 ms 14240 KB Output is correct
178 Correct 89 ms 17716 KB Output is correct
179 Correct 89 ms 18956 KB Output is correct
180 Correct 97 ms 16264 KB Output is correct
181 Correct 96 ms 16644 KB Output is correct
182 Correct 80 ms 16248 KB Output is correct
183 Correct 75 ms 16324 KB Output is correct
184 Correct 79 ms 17036 KB Output is correct
185 Correct 84 ms 16524 KB Output is correct
186 Correct 109 ms 16740 KB Output is correct
187 Correct 102 ms 16612 KB Output is correct
188 Correct 90 ms 16604 KB Output is correct
189 Correct 84 ms 16544 KB Output is correct
190 Correct 95 ms 16316 KB Output is correct
191 Correct 109 ms 16632 KB Output is correct
192 Correct 84 ms 16716 KB Output is correct
193 Correct 90 ms 16500 KB Output is correct
194 Correct 80 ms 16380 KB Output is correct
195 Correct 79 ms 16296 KB Output is correct
196 Correct 109 ms 17052 KB Output is correct
197 Correct 83 ms 16488 KB Output is correct
198 Correct 94 ms 16536 KB Output is correct
199 Correct 89 ms 16592 KB Output is correct
200 Correct 83 ms 16580 KB Output is correct
201 Correct 85 ms 16820 KB Output is correct
202 Correct 89 ms 16428 KB Output is correct
203 Correct 93 ms 16560 KB Output is correct
204 Correct 83 ms 16508 KB Output is correct
205 Correct 92 ms 16432 KB Output is correct
206 Correct 90 ms 16584 KB Output is correct
207 Correct 100 ms 16204 KB Output is correct
208 Correct 87 ms 16524 KB Output is correct
209 Correct 92 ms 16612 KB Output is correct
210 Correct 91 ms 16792 KB Output is correct
211 Correct 88 ms 16448 KB Output is correct
212 Correct 77 ms 16600 KB Output is correct
213 Correct 84 ms 16644 KB Output is correct
214 Correct 88 ms 16560 KB Output is correct
215 Correct 80 ms 16448 KB Output is correct
216 Correct 59 ms 15380 KB Output is correct
217 Correct 85 ms 19648 KB Output is correct
218 Correct 69 ms 18376 KB Output is correct
219 Correct 77 ms 19840 KB Output is correct
220 Correct 84 ms 19448 KB Output is correct
221 Correct 90 ms 18924 KB Output is correct