Submission #628882

# Submission time Handle Problem Language Result Execution time Memory
628882 2022-08-13T19:00:13 Z imeimi2000 Radio Towers (IOI22_towers) C++17
100 / 100
1693 ms 147660 KB
#include "towers.h"

#include <bits/stdc++.h>

using namespace std;
typedef pair<int, int> pii;

const int inf = 1e9 + 5;
struct MaxSeg {
    int seg[1 << 18];
    MaxSeg() {
        fill(seg, seg + (1 << 18), -inf);
    }
    void update(int i, int s, int e, int x, int v) {
        if (s == e) {
            seg[i] = v;
            return;
        }
        int m = (s + e) / 2;
        if (x <= m) update(i + i, s, m, x, v);
        else update(i + i + 1, m + 1, e, x, v);
        seg[i] = max(seg[i + i], seg[i + i + 1]);
    }
    int query(int i, int s, int e, int x, int y) const {
        if (e < x || y < s) return -inf;
        if (x <= s && e <= y) return seg[i];
        int m = (s + e) / 2;
        return max(query(i + i, s, m, x, y), query(i + i + 1, m + 1, e, x, y));
    }
    int find(int i, int s, int e, int x, int v) const {
        if (x < s) return 0;
        if (e <= x && seg[i] <= v) return 0;
        if (s == e) return s;
        int m = (s + e) / 2;
        int r = find(i + i + 1, m + 1, e, x, v);
        if (r) return r;
        return find(i + i, s, m, x, v);
    }
};

struct Pst {
    struct Node {
        int L, R, S;
    };
    int root;
    vector<Node> node;
    vector<int> snapshots;
    Pst() {
        root = 0;
        node.push_back(Node { 0, 0, 0 });
        snapshots.push_back(0);
    }
    int update(int i, int s, int e, int x, int v) {
        int j = node.size();
        node.push_back(node[i]);
        node[j].S += v;
        if (s < e) {
            int m = (s + e) / 2;
            if (x <= m) node[j].L = update(node[j].L, s, m, x, v);
            else node[j].R = update(node[j].R, m + 1, e, x, v);
        }
        return j;
    }
    void update(int x, int v) {
        if (x == 0) return;
        root = update(root, 1, inf, x, v);
    }
    int query(int i, int s, int e, int x, int y) const {
        if (!i || e < x || y < s) return 0;
        if (x <= s && e <= y) return node[i].S;
        int m = (s + e) / 2;
        return query(node[i].L, s, m, x, y) + query(node[i].R, m + 1, e, x, y);
    }
    int query(int t, int x, int y) const {
        return query(snapshots[t], 1, inf, x, y);
    }
    void snapshot() {
        snapshots.push_back(root);
    }
};

int n;
struct Tower {
    MaxSeg min_seg, max_seg;
    int maxD[100005];
    int Lmin[100005];
    int Lpos[100005];
    int Lpar[20][100005];
    int Ldep[100005];
    int V[100005];
    Pst pst;
    void init(vector<int> H) {
        H.insert(H.begin(), inf);
        for (int i = 1; i <= n; ++i) {
            V[i] = H[i];
            min_seg.update(1, 1, n, i, -H[i]);
            max_seg.update(1, 1, n, i, H[i]);
        }
        vector<int> R = { 0, 1 };
        vector<int> L = { 0 };
        pst.snapshot();
        Lmin[0] = Lmin[1] = inf;
        for (int i = 2; i <= n; ++i) {
            int poped = 0;
            Lmin[i] = inf;
            while (H[R.back()] < H[i]) {
                Lmin[i] = min(Lmin[i], min(Lmin[R.back()], H[R.back()]));
                if (L.back() == R.back()) L.pop_back();
                R.pop_back();
                ++poped;
            }
            if (!poped) {
                while (L.back()) {
                    int x = L.back();
                    pst.update(maxD[x], -1);
                    if (Lmin[x] < H[i]) {
                        maxD[x] = H[x] - H[i];
                        pst.update(maxD[x], 1);
                        break;
                    }
                    else {
                        maxD[x] = H[x] - Lmin[x];
                        pst.update(maxD[x], 1);
                        L.pop_back();
                    }
                }
            }
            else {
                Lpar[0][i] = L.back();
                Ldep[i] = Ldep[Lpar[0][i]] + 1;
                L.push_back(i);
            }
            Lpos[i] = L.empty() ? 0 : L.back();
            R.push_back(i);
            pst.snapshot();
        }
        for (int i = 1; i < 20; ++i) {
            for (int j = 1; j <= n; ++j) Lpar[i][j] = Lpar[i - 1][Lpar[i - 1][j]];
        }
    }
    int query(int m, int r, int d) const {
        // printf("m = %d, r = %d\n", m, r);
        if (m == r) return 0;
        int ans = pst.query(r, d, inf) - pst.query(m, d, inf);
        int mn = -min_seg.query(1, 1, n, m + 1, r);
        int x = Lpos[m];
        if (!x) return ans;
        int p = Lpar[0][x];
        if (Lmin[x] + d <= V[x] && mn + d <= V[x]);
        else if (p && Lmin[p] + d <= V[p] && min(mn, Lmin[x]) + d <= V[p]) x = p;
        else {
            for (int i = 20; i--; ) {
                int p = Lpar[i][x];
                int g = Lpar[0][p];
                if (!g) continue;
                if (Lmin[g] + d <= V[g] && min(mn, Lmin[p]) + d <= V[g]);
                else x = p;
            }
            x = Lpar[0][Lpar[0][x]];
        }
        ans -= Ldep[x];
        x = Lpos[m];
        p = Lpar[0][x];
        if (Lmin[x] + d <= V[x] && -min_seg.query(1, 1, n, x + 1, m) + d <= V[x]);
        else if (p && Lmin[p] + d <= V[p] && Lmin[x] + d <= V[p]) x = p;
        else {
            for (int i = 20; i--; ) {
                int p = Lpar[i][x];
                int g = Lpar[0][p];
                if (!g) continue;
                if (Lmin[g] + d <= V[g] && Lmin[p] + d <= V[g]);
                else x = p;
            }
            x = Lpar[0][Lpar[0][x]];
        }
        ans += Ldep[x];
        return ans;
    }
} L, R;

void init(int N, vector<int> H) {
    n = N;
    L.init(H);
    reverse(H.begin(), H.end());
    R.init(H);
}

int max_towers(int L, int R, int D) {
    ++L;
    ++R;
    int V = ::L.max_seg.query(1, 1, n, L, R);
    int M = ::L.max_seg.find(1, 1, n, R, V - 1);
    return ::L.query(M, R, D) + ::R.query(n + 1 - M, n + 1 - L, D) + (V - D >= -::L.min_seg.query(1, 1, n, L, M - 1) && V - D >= -::L.min_seg.query(1, 1, n, M + 1, R)) + 1;
}
# Verdict Execution time Memory Grader output
1 Correct 648 ms 81400 KB Output is correct
2 Correct 1406 ms 125360 KB Output is correct
3 Correct 1151 ms 124320 KB Output is correct
4 Correct 1030 ms 25376 KB Output is correct
5 Correct 888 ms 25116 KB Output is correct
6 Correct 1348 ms 116948 KB Output is correct
7 Correct 901 ms 25100 KB Output is correct
8 Correct 3 ms 4560 KB Output is correct
9 Correct 7 ms 6856 KB Output is correct
10 Correct 3 ms 4944 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 5184 KB Output is correct
2 Correct 6 ms 6668 KB Output is correct
3 Correct 5 ms 6632 KB Output is correct
4 Correct 6 ms 6624 KB Output is correct
5 Correct 5 ms 6632 KB Output is correct
6 Correct 5 ms 6652 KB Output is correct
7 Correct 5 ms 6632 KB Output is correct
8 Correct 3 ms 4944 KB Output is correct
9 Correct 3 ms 4944 KB Output is correct
10 Correct 5 ms 6484 KB Output is correct
11 Correct 6 ms 6224 KB Output is correct
12 Correct 3 ms 4560 KB Output is correct
13 Correct 6 ms 6828 KB Output is correct
14 Correct 3 ms 4944 KB Output is correct
15 Correct 5 ms 6632 KB Output is correct
16 Correct 5 ms 6632 KB Output is correct
17 Correct 5 ms 6632 KB Output is correct
18 Correct 3 ms 4944 KB Output is correct
19 Correct 4 ms 5720 KB Output is correct
20 Correct 5 ms 6624 KB Output is correct
21 Correct 6 ms 6632 KB Output is correct
22 Correct 5 ms 6632 KB Output is correct
23 Correct 3 ms 4944 KB Output is correct
24 Correct 4 ms 5460 KB Output is correct
25 Correct 3 ms 5592 KB Output is correct
26 Correct 5 ms 6624 KB Output is correct
27 Correct 6 ms 6652 KB Output is correct
28 Correct 6 ms 6648 KB Output is correct
29 Correct 6 ms 6656 KB Output is correct
30 Correct 6 ms 6668 KB Output is correct
31 Correct 6 ms 6604 KB Output is correct
32 Correct 3 ms 4944 KB Output is correct
33 Correct 3 ms 4944 KB Output is correct
34 Correct 4 ms 5580 KB Output is correct
35 Correct 4 ms 6088 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 5184 KB Output is correct
2 Correct 6 ms 6668 KB Output is correct
3 Correct 5 ms 6632 KB Output is correct
4 Correct 6 ms 6624 KB Output is correct
5 Correct 5 ms 6632 KB Output is correct
6 Correct 5 ms 6652 KB Output is correct
7 Correct 5 ms 6632 KB Output is correct
8 Correct 3 ms 4944 KB Output is correct
9 Correct 3 ms 4944 KB Output is correct
10 Correct 5 ms 6484 KB Output is correct
11 Correct 6 ms 6224 KB Output is correct
12 Correct 3 ms 4560 KB Output is correct
13 Correct 6 ms 6828 KB Output is correct
14 Correct 3 ms 4944 KB Output is correct
15 Correct 5 ms 6632 KB Output is correct
16 Correct 5 ms 6632 KB Output is correct
17 Correct 5 ms 6632 KB Output is correct
18 Correct 3 ms 4944 KB Output is correct
19 Correct 4 ms 5720 KB Output is correct
20 Correct 5 ms 6624 KB Output is correct
21 Correct 6 ms 6632 KB Output is correct
22 Correct 5 ms 6632 KB Output is correct
23 Correct 3 ms 4944 KB Output is correct
24 Correct 4 ms 5460 KB Output is correct
25 Correct 3 ms 5592 KB Output is correct
26 Correct 5 ms 6624 KB Output is correct
27 Correct 6 ms 6652 KB Output is correct
28 Correct 6 ms 6648 KB Output is correct
29 Correct 6 ms 6656 KB Output is correct
30 Correct 6 ms 6668 KB Output is correct
31 Correct 6 ms 6604 KB Output is correct
32 Correct 3 ms 4944 KB Output is correct
33 Correct 3 ms 4944 KB Output is correct
34 Correct 4 ms 5580 KB Output is correct
35 Correct 4 ms 6088 KB Output is correct
36 Correct 120 ms 90364 KB Output is correct
37 Correct 210 ms 147648 KB Output is correct
38 Correct 194 ms 147520 KB Output is correct
39 Correct 198 ms 147512 KB Output is correct
40 Correct 194 ms 147452 KB Output is correct
41 Correct 211 ms 147524 KB Output is correct
42 Correct 215 ms 147516 KB Output is correct
43 Correct 52 ms 25320 KB Output is correct
44 Correct 54 ms 25132 KB Output is correct
45 Correct 119 ms 66372 KB Output is correct
46 Correct 108 ms 56620 KB Output is correct
47 Correct 195 ms 147416 KB Output is correct
48 Correct 206 ms 147520 KB Output is correct
49 Correct 204 ms 147600 KB Output is correct
50 Correct 54 ms 25112 KB Output is correct
51 Correct 57 ms 28068 KB Output is correct
52 Correct 212 ms 147448 KB Output is correct
53 Correct 198 ms 147492 KB Output is correct
54 Correct 205 ms 147496 KB Output is correct
55 Correct 60 ms 25136 KB Output is correct
56 Correct 117 ms 69372 KB Output is correct
57 Correct 193 ms 144472 KB Output is correct
58 Correct 197 ms 147412 KB Output is correct
59 Correct 218 ms 147468 KB Output is correct
60 Correct 217 ms 147504 KB Output is correct
61 Correct 200 ms 147520 KB Output is correct
62 Correct 217 ms 147416 KB Output is correct
63 Correct 209 ms 147448 KB Output is correct
64 Correct 55 ms 25392 KB Output is correct
65 Correct 67 ms 25136 KB Output is correct
66 Correct 167 ms 116688 KB Output is correct
67 Correct 60 ms 29480 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1215 ms 147008 KB Output is correct
2 Correct 1358 ms 147416 KB Output is correct
3 Correct 1416 ms 147640 KB Output is correct
4 Correct 1335 ms 147660 KB Output is correct
5 Correct 1331 ms 147616 KB Output is correct
6 Correct 1262 ms 147472 KB Output is correct
7 Correct 1414 ms 147536 KB Output is correct
8 Correct 1081 ms 25348 KB Output is correct
9 Correct 1130 ms 25144 KB Output is correct
10 Correct 1178 ms 48356 KB Output is correct
11 Correct 1217 ms 66404 KB Output is correct
12 Correct 1307 ms 116940 KB Output is correct
13 Correct 987 ms 25116 KB Output is correct
14 Correct 2 ms 4560 KB Output is correct
15 Correct 6 ms 6856 KB Output is correct
16 Correct 4 ms 4944 KB Output is correct
17 Correct 201 ms 147520 KB Output is correct
18 Correct 197 ms 147424 KB Output is correct
19 Correct 202 ms 147612 KB Output is correct
20 Correct 68 ms 25124 KB Output is correct
21 Correct 56 ms 28168 KB Output is correct
22 Correct 192 ms 147532 KB Output is correct
23 Correct 220 ms 147492 KB Output is correct
24 Correct 210 ms 147500 KB Output is correct
25 Correct 51 ms 25132 KB Output is correct
26 Correct 121 ms 69328 KB Output is correct
27 Correct 6 ms 6632 KB Output is correct
28 Correct 5 ms 6632 KB Output is correct
29 Correct 6 ms 6632 KB Output is correct
30 Correct 4 ms 5056 KB Output is correct
31 Correct 4 ms 5720 KB Output is correct
32 Correct 5 ms 6624 KB Output is correct
33 Correct 7 ms 6704 KB Output is correct
34 Correct 6 ms 6692 KB Output is correct
35 Correct 3 ms 4944 KB Output is correct
36 Correct 4 ms 5460 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 390 ms 39368 KB Output is correct
2 Correct 1484 ms 147540 KB Output is correct
3 Correct 1527 ms 147604 KB Output is correct
4 Correct 1269 ms 147444 KB Output is correct
5 Correct 1264 ms 147428 KB Output is correct
6 Correct 1267 ms 147492 KB Output is correct
7 Correct 1386 ms 147528 KB Output is correct
8 Correct 610 ms 25384 KB Output is correct
9 Correct 602 ms 25136 KB Output is correct
10 Correct 917 ms 74204 KB Output is correct
11 Correct 793 ms 106112 KB Output is correct
12 Correct 206 ms 147492 KB Output is correct
13 Correct 194 ms 147524 KB Output is correct
14 Correct 197 ms 147524 KB Output is correct
15 Correct 52 ms 25144 KB Output is correct
16 Correct 126 ms 69316 KB Output is correct
17 Correct 204 ms 144452 KB Output is correct
18 Correct 201 ms 147504 KB Output is correct
19 Correct 213 ms 147504 KB Output is correct
20 Correct 201 ms 147516 KB Output is correct
21 Correct 208 ms 147464 KB Output is correct
22 Correct 193 ms 147524 KB Output is correct
23 Correct 201 ms 147580 KB Output is correct
24 Correct 52 ms 25380 KB Output is correct
25 Correct 57 ms 25104 KB Output is correct
26 Correct 153 ms 116700 KB Output is correct
27 Correct 57 ms 29520 KB Output is correct
28 Correct 6 ms 6624 KB Output is correct
29 Correct 6 ms 6632 KB Output is correct
30 Correct 7 ms 6608 KB Output is correct
31 Correct 3 ms 4944 KB Output is correct
32 Correct 4 ms 5544 KB Output is correct
33 Correct 4 ms 5592 KB Output is correct
34 Correct 5 ms 6624 KB Output is correct
35 Correct 6 ms 6668 KB Output is correct
36 Correct 6 ms 6632 KB Output is correct
37 Correct 5 ms 6684 KB Output is correct
38 Correct 5 ms 6648 KB Output is correct
39 Correct 5 ms 6620 KB Output is correct
40 Correct 3 ms 4944 KB Output is correct
41 Correct 3 ms 4944 KB Output is correct
42 Correct 4 ms 5580 KB Output is correct
43 Correct 5 ms 6088 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 5184 KB Output is correct
2 Correct 6 ms 6668 KB Output is correct
3 Correct 5 ms 6632 KB Output is correct
4 Correct 6 ms 6624 KB Output is correct
5 Correct 5 ms 6632 KB Output is correct
6 Correct 5 ms 6652 KB Output is correct
7 Correct 5 ms 6632 KB Output is correct
8 Correct 3 ms 4944 KB Output is correct
9 Correct 3 ms 4944 KB Output is correct
10 Correct 5 ms 6484 KB Output is correct
11 Correct 6 ms 6224 KB Output is correct
12 Correct 3 ms 4560 KB Output is correct
13 Correct 6 ms 6828 KB Output is correct
14 Correct 3 ms 4944 KB Output is correct
15 Correct 5 ms 6632 KB Output is correct
16 Correct 5 ms 6632 KB Output is correct
17 Correct 5 ms 6632 KB Output is correct
18 Correct 3 ms 4944 KB Output is correct
19 Correct 4 ms 5720 KB Output is correct
20 Correct 5 ms 6624 KB Output is correct
21 Correct 6 ms 6632 KB Output is correct
22 Correct 5 ms 6632 KB Output is correct
23 Correct 3 ms 4944 KB Output is correct
24 Correct 4 ms 5460 KB Output is correct
25 Correct 3 ms 5592 KB Output is correct
26 Correct 5 ms 6624 KB Output is correct
27 Correct 6 ms 6652 KB Output is correct
28 Correct 6 ms 6648 KB Output is correct
29 Correct 6 ms 6656 KB Output is correct
30 Correct 6 ms 6668 KB Output is correct
31 Correct 6 ms 6604 KB Output is correct
32 Correct 3 ms 4944 KB Output is correct
33 Correct 3 ms 4944 KB Output is correct
34 Correct 4 ms 5580 KB Output is correct
35 Correct 4 ms 6088 KB Output is correct
36 Correct 120 ms 90364 KB Output is correct
37 Correct 210 ms 147648 KB Output is correct
38 Correct 194 ms 147520 KB Output is correct
39 Correct 198 ms 147512 KB Output is correct
40 Correct 194 ms 147452 KB Output is correct
41 Correct 211 ms 147524 KB Output is correct
42 Correct 215 ms 147516 KB Output is correct
43 Correct 52 ms 25320 KB Output is correct
44 Correct 54 ms 25132 KB Output is correct
45 Correct 119 ms 66372 KB Output is correct
46 Correct 108 ms 56620 KB Output is correct
47 Correct 195 ms 147416 KB Output is correct
48 Correct 206 ms 147520 KB Output is correct
49 Correct 204 ms 147600 KB Output is correct
50 Correct 54 ms 25112 KB Output is correct
51 Correct 57 ms 28068 KB Output is correct
52 Correct 212 ms 147448 KB Output is correct
53 Correct 198 ms 147492 KB Output is correct
54 Correct 205 ms 147496 KB Output is correct
55 Correct 60 ms 25136 KB Output is correct
56 Correct 117 ms 69372 KB Output is correct
57 Correct 193 ms 144472 KB Output is correct
58 Correct 197 ms 147412 KB Output is correct
59 Correct 218 ms 147468 KB Output is correct
60 Correct 217 ms 147504 KB Output is correct
61 Correct 200 ms 147520 KB Output is correct
62 Correct 217 ms 147416 KB Output is correct
63 Correct 209 ms 147448 KB Output is correct
64 Correct 55 ms 25392 KB Output is correct
65 Correct 67 ms 25136 KB Output is correct
66 Correct 167 ms 116688 KB Output is correct
67 Correct 60 ms 29480 KB Output is correct
68 Correct 1215 ms 147008 KB Output is correct
69 Correct 1358 ms 147416 KB Output is correct
70 Correct 1416 ms 147640 KB Output is correct
71 Correct 1335 ms 147660 KB Output is correct
72 Correct 1331 ms 147616 KB Output is correct
73 Correct 1262 ms 147472 KB Output is correct
74 Correct 1414 ms 147536 KB Output is correct
75 Correct 1081 ms 25348 KB Output is correct
76 Correct 1130 ms 25144 KB Output is correct
77 Correct 1178 ms 48356 KB Output is correct
78 Correct 1217 ms 66404 KB Output is correct
79 Correct 1307 ms 116940 KB Output is correct
80 Correct 987 ms 25116 KB Output is correct
81 Correct 2 ms 4560 KB Output is correct
82 Correct 6 ms 6856 KB Output is correct
83 Correct 4 ms 4944 KB Output is correct
84 Correct 201 ms 147520 KB Output is correct
85 Correct 197 ms 147424 KB Output is correct
86 Correct 202 ms 147612 KB Output is correct
87 Correct 68 ms 25124 KB Output is correct
88 Correct 56 ms 28168 KB Output is correct
89 Correct 192 ms 147532 KB Output is correct
90 Correct 220 ms 147492 KB Output is correct
91 Correct 210 ms 147500 KB Output is correct
92 Correct 51 ms 25132 KB Output is correct
93 Correct 121 ms 69328 KB Output is correct
94 Correct 6 ms 6632 KB Output is correct
95 Correct 5 ms 6632 KB Output is correct
96 Correct 6 ms 6632 KB Output is correct
97 Correct 4 ms 5056 KB Output is correct
98 Correct 4 ms 5720 KB Output is correct
99 Correct 5 ms 6624 KB Output is correct
100 Correct 7 ms 6704 KB Output is correct
101 Correct 6 ms 6692 KB Output is correct
102 Correct 3 ms 4944 KB Output is correct
103 Correct 4 ms 5460 KB Output is correct
104 Correct 1185 ms 137108 KB Output is correct
105 Correct 1406 ms 147412 KB Output is correct
106 Correct 1493 ms 147536 KB Output is correct
107 Correct 1388 ms 147596 KB Output is correct
108 Correct 1529 ms 147532 KB Output is correct
109 Correct 1456 ms 147548 KB Output is correct
110 Correct 1402 ms 147448 KB Output is correct
111 Correct 1032 ms 25396 KB Output is correct
112 Correct 893 ms 25132 KB Output is correct
113 Correct 1153 ms 116592 KB Output is correct
114 Correct 1080 ms 63704 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 648 ms 81400 KB Output is correct
2 Correct 1406 ms 125360 KB Output is correct
3 Correct 1151 ms 124320 KB Output is correct
4 Correct 1030 ms 25376 KB Output is correct
5 Correct 888 ms 25116 KB Output is correct
6 Correct 1348 ms 116948 KB Output is correct
7 Correct 901 ms 25100 KB Output is correct
8 Correct 3 ms 4560 KB Output is correct
9 Correct 7 ms 6856 KB Output is correct
10 Correct 3 ms 4944 KB Output is correct
11 Correct 3 ms 5184 KB Output is correct
12 Correct 6 ms 6668 KB Output is correct
13 Correct 5 ms 6632 KB Output is correct
14 Correct 6 ms 6624 KB Output is correct
15 Correct 5 ms 6632 KB Output is correct
16 Correct 5 ms 6652 KB Output is correct
17 Correct 5 ms 6632 KB Output is correct
18 Correct 3 ms 4944 KB Output is correct
19 Correct 3 ms 4944 KB Output is correct
20 Correct 5 ms 6484 KB Output is correct
21 Correct 6 ms 6224 KB Output is correct
22 Correct 3 ms 4560 KB Output is correct
23 Correct 6 ms 6828 KB Output is correct
24 Correct 3 ms 4944 KB Output is correct
25 Correct 5 ms 6632 KB Output is correct
26 Correct 5 ms 6632 KB Output is correct
27 Correct 5 ms 6632 KB Output is correct
28 Correct 3 ms 4944 KB Output is correct
29 Correct 4 ms 5720 KB Output is correct
30 Correct 5 ms 6624 KB Output is correct
31 Correct 6 ms 6632 KB Output is correct
32 Correct 5 ms 6632 KB Output is correct
33 Correct 3 ms 4944 KB Output is correct
34 Correct 4 ms 5460 KB Output is correct
35 Correct 3 ms 5592 KB Output is correct
36 Correct 5 ms 6624 KB Output is correct
37 Correct 6 ms 6652 KB Output is correct
38 Correct 6 ms 6648 KB Output is correct
39 Correct 6 ms 6656 KB Output is correct
40 Correct 6 ms 6668 KB Output is correct
41 Correct 6 ms 6604 KB Output is correct
42 Correct 3 ms 4944 KB Output is correct
43 Correct 3 ms 4944 KB Output is correct
44 Correct 4 ms 5580 KB Output is correct
45 Correct 4 ms 6088 KB Output is correct
46 Correct 120 ms 90364 KB Output is correct
47 Correct 210 ms 147648 KB Output is correct
48 Correct 194 ms 147520 KB Output is correct
49 Correct 198 ms 147512 KB Output is correct
50 Correct 194 ms 147452 KB Output is correct
51 Correct 211 ms 147524 KB Output is correct
52 Correct 215 ms 147516 KB Output is correct
53 Correct 52 ms 25320 KB Output is correct
54 Correct 54 ms 25132 KB Output is correct
55 Correct 119 ms 66372 KB Output is correct
56 Correct 108 ms 56620 KB Output is correct
57 Correct 195 ms 147416 KB Output is correct
58 Correct 206 ms 147520 KB Output is correct
59 Correct 204 ms 147600 KB Output is correct
60 Correct 54 ms 25112 KB Output is correct
61 Correct 57 ms 28068 KB Output is correct
62 Correct 212 ms 147448 KB Output is correct
63 Correct 198 ms 147492 KB Output is correct
64 Correct 205 ms 147496 KB Output is correct
65 Correct 60 ms 25136 KB Output is correct
66 Correct 117 ms 69372 KB Output is correct
67 Correct 193 ms 144472 KB Output is correct
68 Correct 197 ms 147412 KB Output is correct
69 Correct 218 ms 147468 KB Output is correct
70 Correct 217 ms 147504 KB Output is correct
71 Correct 200 ms 147520 KB Output is correct
72 Correct 217 ms 147416 KB Output is correct
73 Correct 209 ms 147448 KB Output is correct
74 Correct 55 ms 25392 KB Output is correct
75 Correct 67 ms 25136 KB Output is correct
76 Correct 167 ms 116688 KB Output is correct
77 Correct 60 ms 29480 KB Output is correct
78 Correct 1215 ms 147008 KB Output is correct
79 Correct 1358 ms 147416 KB Output is correct
80 Correct 1416 ms 147640 KB Output is correct
81 Correct 1335 ms 147660 KB Output is correct
82 Correct 1331 ms 147616 KB Output is correct
83 Correct 1262 ms 147472 KB Output is correct
84 Correct 1414 ms 147536 KB Output is correct
85 Correct 1081 ms 25348 KB Output is correct
86 Correct 1130 ms 25144 KB Output is correct
87 Correct 1178 ms 48356 KB Output is correct
88 Correct 1217 ms 66404 KB Output is correct
89 Correct 1307 ms 116940 KB Output is correct
90 Correct 987 ms 25116 KB Output is correct
91 Correct 2 ms 4560 KB Output is correct
92 Correct 6 ms 6856 KB Output is correct
93 Correct 4 ms 4944 KB Output is correct
94 Correct 201 ms 147520 KB Output is correct
95 Correct 197 ms 147424 KB Output is correct
96 Correct 202 ms 147612 KB Output is correct
97 Correct 68 ms 25124 KB Output is correct
98 Correct 56 ms 28168 KB Output is correct
99 Correct 192 ms 147532 KB Output is correct
100 Correct 220 ms 147492 KB Output is correct
101 Correct 210 ms 147500 KB Output is correct
102 Correct 51 ms 25132 KB Output is correct
103 Correct 121 ms 69328 KB Output is correct
104 Correct 6 ms 6632 KB Output is correct
105 Correct 5 ms 6632 KB Output is correct
106 Correct 6 ms 6632 KB Output is correct
107 Correct 4 ms 5056 KB Output is correct
108 Correct 4 ms 5720 KB Output is correct
109 Correct 5 ms 6624 KB Output is correct
110 Correct 7 ms 6704 KB Output is correct
111 Correct 6 ms 6692 KB Output is correct
112 Correct 3 ms 4944 KB Output is correct
113 Correct 4 ms 5460 KB Output is correct
114 Correct 390 ms 39368 KB Output is correct
115 Correct 1484 ms 147540 KB Output is correct
116 Correct 1527 ms 147604 KB Output is correct
117 Correct 1269 ms 147444 KB Output is correct
118 Correct 1264 ms 147428 KB Output is correct
119 Correct 1267 ms 147492 KB Output is correct
120 Correct 1386 ms 147528 KB Output is correct
121 Correct 610 ms 25384 KB Output is correct
122 Correct 602 ms 25136 KB Output is correct
123 Correct 917 ms 74204 KB Output is correct
124 Correct 793 ms 106112 KB Output is correct
125 Correct 206 ms 147492 KB Output is correct
126 Correct 194 ms 147524 KB Output is correct
127 Correct 197 ms 147524 KB Output is correct
128 Correct 52 ms 25144 KB Output is correct
129 Correct 126 ms 69316 KB Output is correct
130 Correct 204 ms 144452 KB Output is correct
131 Correct 201 ms 147504 KB Output is correct
132 Correct 213 ms 147504 KB Output is correct
133 Correct 201 ms 147516 KB Output is correct
134 Correct 208 ms 147464 KB Output is correct
135 Correct 193 ms 147524 KB Output is correct
136 Correct 201 ms 147580 KB Output is correct
137 Correct 52 ms 25380 KB Output is correct
138 Correct 57 ms 25104 KB Output is correct
139 Correct 153 ms 116700 KB Output is correct
140 Correct 57 ms 29520 KB Output is correct
141 Correct 6 ms 6624 KB Output is correct
142 Correct 6 ms 6632 KB Output is correct
143 Correct 7 ms 6608 KB Output is correct
144 Correct 3 ms 4944 KB Output is correct
145 Correct 4 ms 5544 KB Output is correct
146 Correct 4 ms 5592 KB Output is correct
147 Correct 5 ms 6624 KB Output is correct
148 Correct 6 ms 6668 KB Output is correct
149 Correct 6 ms 6632 KB Output is correct
150 Correct 5 ms 6684 KB Output is correct
151 Correct 5 ms 6648 KB Output is correct
152 Correct 5 ms 6620 KB Output is correct
153 Correct 3 ms 4944 KB Output is correct
154 Correct 3 ms 4944 KB Output is correct
155 Correct 4 ms 5580 KB Output is correct
156 Correct 5 ms 6088 KB Output is correct
157 Correct 1185 ms 137108 KB Output is correct
158 Correct 1406 ms 147412 KB Output is correct
159 Correct 1493 ms 147536 KB Output is correct
160 Correct 1388 ms 147596 KB Output is correct
161 Correct 1529 ms 147532 KB Output is correct
162 Correct 1456 ms 147548 KB Output is correct
163 Correct 1402 ms 147448 KB Output is correct
164 Correct 1032 ms 25396 KB Output is correct
165 Correct 893 ms 25132 KB Output is correct
166 Correct 1153 ms 116592 KB Output is correct
167 Correct 1080 ms 63704 KB Output is correct
168 Correct 2 ms 4560 KB Output is correct
169 Correct 946 ms 61736 KB Output is correct
170 Correct 1630 ms 147480 KB Output is correct
171 Correct 1652 ms 147416 KB Output is correct
172 Correct 1647 ms 147548 KB Output is correct
173 Correct 1629 ms 147432 KB Output is correct
174 Correct 1693 ms 147440 KB Output is correct
175 Correct 1630 ms 147524 KB Output is correct
176 Correct 1084 ms 25356 KB Output is correct
177 Correct 998 ms 25072 KB Output is correct
178 Correct 1306 ms 116572 KB Output is correct
179 Correct 1186 ms 66244 KB Output is correct