답안 #635193

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
635193 2022-08-25T15:36:42 Z phathnv 송신탑 (IOI22_towers) C++17
100 / 100
1909 ms 96184 KB
#include "towers.h"

#include <bits/stdc++.h>
using namespace std;

struct Node {
    Node* nLeft;
    Node* nRight;
    int l, r, sum, minPos, maxPos, minVal;
    Node(int _l, int _r, int val) {
        nLeft = nRight = nullptr;
        l = _l;
        r = _r;
        sum = 0;
        minPos = 1e9;
        maxPos = -1e9;
        minVal = val;
        assert(l <= r);
    }
};

Node* mergeNode(Node* a, Node* b) {
    assert(a->r + 1 == b->l);
    Node* res = new Node(a->l, b->r, 1e9);
    res->nLeft = a;
    res->nRight = b;
    res->sum = a->sum + b->sum;
    res->minPos = min(a->minPos, b->minPos);
    res->maxPos = max(a->maxPos, b->maxPos);
    res->minVal = min(a->minVal, b->minVal);
    return res;
}

Node* build(int l, int r, const vector<int>& h, const vector<bool>& mark) {
    if (l == r) {
        Node* n = new Node(l, r, h[l]);
        if (mark[l]) {
            n->sum = 1;
            n->minPos = n->maxPos = l;
        }
        return n;
    }
    int mid = (l + r) >> 1;
    return mergeNode(build(l, mid, h, mark), build(mid + 1, r, h, mark));
}

Node* update(Node* n, int pos) {
    if (pos < n->l || n->r < pos) {
        return n;
    }
    if (n->l == n->r) {
        assert(n->sum == 1);
        return new Node(n->l, n->r, n->minVal);
    }
    return mergeNode(update(n->nLeft, pos), update(n->nRight, pos));
}

int getMin(Node*n, int l, int r) {
    if (r < n->l || n->r < l) {
        return 1e9;
    }
    if (l <= n->l && n->r <= r) {
        return n->minVal;
    }
    return min(getMin(n->nLeft, l, r), getMin(n->nRight, l, r));
}

void get(Node*n, int l, int r, int &x, int &y, int &sum) {
    if (r < n->l || n->r < l) {
        return;
    }
    if (l <= n->l && n->r <= r) {
        sum += n->sum;
        x = min(x, n->minPos);
        y = max(y, n->maxPos);
        return;
    }
    get(n->nLeft, l, r, x, y, sum);
    get(n->nRight, l, r, x, y, sum);
}

int n;
vector<int> h;
vector<int> type, changingPoint;
vector<Node*> roots;

void init(int _n, vector<int> _h) {
    n = _n;
    h = _h;

    set<int> s;
    s.insert(0);
    for (int i = 1; i < n; ++i) {
        if (s.size() & 1) {
            if (h[i] > h[*s.rbegin()]) {
                s.insert(i);
            } else {
                s.erase(*s.rbegin());
                s.insert(i);
            }
        } else {
            if (h[i] < h[*s.rbegin()]) {
                s.insert(i);
            } else {
                s.erase(*s.rbegin());
                s.insert(i);
            }
        }
    }
    if (s.size() % 2 == 0) {
        s.erase(*s.rbegin());
    }

    vector<bool> mark(n, false);
    for (auto x : s) {
        mark[x] = true;
    }
    changingPoint.push_back(0);
    roots.push_back(build(0, n - 1, h, mark));

    priority_queue<array<int, 3>> pq;
    type.assign(n, -1);
    int pre = -1, t = 0;
    for (int cur : s) {
        type[cur] = t;
        t ^= 1;
        if (pre != -1) {
            pq.push({-abs(h[pre] - h[cur]), pre, cur});
        }
        pre = cur;
    }

    int last = 0;
    while (!pq.empty()) {
        auto [d, l, r] = pq.top();
        pq.pop();
        if (!mark[l] || !mark[r]) {
            continue;
        }

        d = -d;
        if (d != last) {
            changingPoint.push_back(d);
            roots.push_back(roots.back());
            last = d;
        }

        int a[5] = {-1, -1, -1, -1, -1};

        if (h[l] > h[r]) {
            a[1] = l;
            a[2] = r;
            auto it = s.lower_bound(l);
            if (it != s.begin()) {
                a[0] = *(--it);
            }
            it = s.lower_bound(r);
            ++it;
            if (it != s.end()) {
                a[3] = *it;
                ++it;
            }
            if (it != s.end()) {
                a[4] = *it;
                ++it;
            }
        } else {
            a[2] = l;
            a[3] = r;
            auto it = s.lower_bound(l);
            if (it != s.begin()) {
                a[1] = *(--it);
            }
            if (it != s.begin()) {
                a[0] = *(--it);
            }
            it = s.lower_bound(r);
            ++it;
            if (it != s.end()) {
                a[4] = *it;
                ++it;
            }
        }

        roots.back() = update(roots.back(), a[2]);
        mark[a[2]] = false;
        s.erase(a[2]);
        if (a[1] == -1 || a[3] == -1) {
            if (a[1] != -1) {
                roots.back() = update(roots.back(), a[1]);
                mark[a[1]] = false;
                s.erase(a[1]);
            }
            if (a[3] != -1) {
                roots.back() = update(roots.back(), a[3]);
                mark[a[3]] = false;
                s.erase(a[3]);
            }
        } else {
            if (h[a[1]] > h[a[3]]) {
                roots.back() = update(roots.back(), a[3]);
                mark[a[3]] = false;
                s.erase(a[3]);
                pq.push({-abs(h[a[1]] - h[a[4]]), a[1], a[4]});
            } else {
                roots.back() = update(roots.back(), a[1]);
                mark[a[1]] = false;
                s.erase(a[1]);
                pq.push({-abs(h[a[0]] - h[a[3]]), a[0], a[3]});
            }
        }
    }
}

int max_towers(int l, int r, int d) {
    Node* root = roots[lower_bound(changingPoint.begin(), changingPoint.end(), d) - changingPoint.begin() - 1];

    int x = 1e9, y = -1e9, res = 0;
    get(root, l, r, x, y, res);

    if (x > y) {
        return 1;
    }

    assert(type[x] != -1 && type[y] != -1);

    if (type[x] == 1) {
        int minVal = 1e9;
        for (int i = l; i <= x - 1; ++i) {
            if (minVal > h[i]) {
                minVal = h[i];
            }
        }

        if (h[x] - d >= getMin(root, l, x - 1)) {
            ++res;
        } else {
            --res;
        }
    }
    if (type[y] == 1) {
        if (h[y] - d >= getMin(root, y + 1, r)) {
            ++res;
        } else {
            --res;
        }
    }
    return max(1, (res + 1) / 2);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 582 ms 6816 KB Output is correct
2 Correct 1138 ms 11208 KB Output is correct
3 Correct 1200 ms 11180 KB Output is correct
4 Correct 1012 ms 11220 KB Output is correct
5 Correct 902 ms 11168 KB Output is correct
6 Correct 1122 ms 11280 KB Output is correct
7 Correct 1029 ms 11180 KB Output is correct
8 Correct 0 ms 208 KB Output is correct
9 Correct 1 ms 464 KB Output is correct
10 Correct 1 ms 464 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 464 KB Output is correct
2 Correct 3 ms 1232 KB Output is correct
3 Correct 2 ms 1232 KB Output is correct
4 Correct 4 ms 1616 KB Output is correct
5 Correct 3 ms 1664 KB Output is correct
6 Correct 5 ms 1616 KB Output is correct
7 Correct 4 ms 1616 KB Output is correct
8 Correct 1 ms 464 KB Output is correct
9 Correct 1 ms 464 KB Output is correct
10 Correct 1 ms 464 KB Output is correct
11 Correct 1 ms 464 KB Output is correct
12 Correct 0 ms 208 KB Output is correct
13 Correct 1 ms 464 KB Output is correct
14 Correct 2 ms 464 KB Output is correct
15 Correct 3 ms 1232 KB Output is correct
16 Correct 3 ms 1616 KB Output is correct
17 Correct 4 ms 1560 KB Output is correct
18 Correct 1 ms 464 KB Output is correct
19 Correct 1 ms 464 KB Output is correct
20 Correct 2 ms 1232 KB Output is correct
21 Correct 3 ms 1628 KB Output is correct
22 Correct 5 ms 1616 KB Output is correct
23 Correct 1 ms 464 KB Output is correct
24 Correct 1 ms 464 KB Output is correct
25 Correct 2 ms 592 KB Output is correct
26 Correct 3 ms 1232 KB Output is correct
27 Correct 3 ms 1232 KB Output is correct
28 Correct 3 ms 1616 KB Output is correct
29 Correct 4 ms 1616 KB Output is correct
30 Correct 3 ms 1656 KB Output is correct
31 Correct 3 ms 1616 KB Output is correct
32 Correct 1 ms 464 KB Output is correct
33 Correct 1 ms 464 KB Output is correct
34 Correct 1 ms 512 KB Output is correct
35 Correct 1 ms 464 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 464 KB Output is correct
2 Correct 3 ms 1232 KB Output is correct
3 Correct 2 ms 1232 KB Output is correct
4 Correct 4 ms 1616 KB Output is correct
5 Correct 3 ms 1664 KB Output is correct
6 Correct 5 ms 1616 KB Output is correct
7 Correct 4 ms 1616 KB Output is correct
8 Correct 1 ms 464 KB Output is correct
9 Correct 1 ms 464 KB Output is correct
10 Correct 1 ms 464 KB Output is correct
11 Correct 1 ms 464 KB Output is correct
12 Correct 0 ms 208 KB Output is correct
13 Correct 1 ms 464 KB Output is correct
14 Correct 2 ms 464 KB Output is correct
15 Correct 3 ms 1232 KB Output is correct
16 Correct 3 ms 1616 KB Output is correct
17 Correct 4 ms 1560 KB Output is correct
18 Correct 1 ms 464 KB Output is correct
19 Correct 1 ms 464 KB Output is correct
20 Correct 2 ms 1232 KB Output is correct
21 Correct 3 ms 1628 KB Output is correct
22 Correct 5 ms 1616 KB Output is correct
23 Correct 1 ms 464 KB Output is correct
24 Correct 1 ms 464 KB Output is correct
25 Correct 2 ms 592 KB Output is correct
26 Correct 3 ms 1232 KB Output is correct
27 Correct 3 ms 1232 KB Output is correct
28 Correct 3 ms 1616 KB Output is correct
29 Correct 4 ms 1616 KB Output is correct
30 Correct 3 ms 1656 KB Output is correct
31 Correct 3 ms 1616 KB Output is correct
32 Correct 1 ms 464 KB Output is correct
33 Correct 1 ms 464 KB Output is correct
34 Correct 1 ms 512 KB Output is correct
35 Correct 1 ms 464 KB Output is correct
36 Correct 111 ms 42688 KB Output is correct
37 Correct 181 ms 67984 KB Output is correct
38 Correct 200 ms 67728 KB Output is correct
39 Correct 267 ms 96120 KB Output is correct
40 Correct 267 ms 96160 KB Output is correct
41 Correct 271 ms 96064 KB Output is correct
42 Correct 269 ms 96096 KB Output is correct
43 Correct 33 ms 11184 KB Output is correct
44 Correct 26 ms 11176 KB Output is correct
45 Correct 28 ms 11164 KB Output is correct
46 Correct 26 ms 11164 KB Output is correct
47 Correct 198 ms 67668 KB Output is correct
48 Correct 265 ms 96012 KB Output is correct
49 Correct 290 ms 96016 KB Output is correct
50 Correct 28 ms 11204 KB Output is correct
51 Correct 27 ms 11224 KB Output is correct
52 Correct 201 ms 67676 KB Output is correct
53 Correct 274 ms 96020 KB Output is correct
54 Correct 292 ms 96028 KB Output is correct
55 Correct 24 ms 11160 KB Output is correct
56 Correct 30 ms 11164 KB Output is correct
57 Correct 194 ms 65440 KB Output is correct
58 Correct 197 ms 67772 KB Output is correct
59 Correct 241 ms 67924 KB Output is correct
60 Correct 261 ms 96052 KB Output is correct
61 Correct 271 ms 96096 KB Output is correct
62 Correct 278 ms 96076 KB Output is correct
63 Correct 274 ms 96112 KB Output is correct
64 Correct 33 ms 11220 KB Output is correct
65 Correct 27 ms 11208 KB Output is correct
66 Correct 34 ms 11192 KB Output is correct
67 Correct 28 ms 11156 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1062 ms 67112 KB Output is correct
2 Correct 1213 ms 67908 KB Output is correct
3 Correct 1236 ms 67888 KB Output is correct
4 Correct 1499 ms 96036 KB Output is correct
5 Correct 1559 ms 96068 KB Output is correct
6 Correct 1397 ms 96096 KB Output is correct
7 Correct 1083 ms 96076 KB Output is correct
8 Correct 1130 ms 11184 KB Output is correct
9 Correct 943 ms 11160 KB Output is correct
10 Correct 1165 ms 11156 KB Output is correct
11 Correct 1127 ms 11184 KB Output is correct
12 Correct 1135 ms 11180 KB Output is correct
13 Correct 1026 ms 11148 KB Output is correct
14 Correct 0 ms 208 KB Output is correct
15 Correct 1 ms 464 KB Output is correct
16 Correct 1 ms 464 KB Output is correct
17 Correct 210 ms 67732 KB Output is correct
18 Correct 259 ms 96128 KB Output is correct
19 Correct 268 ms 96076 KB Output is correct
20 Correct 27 ms 11152 KB Output is correct
21 Correct 26 ms 11180 KB Output is correct
22 Correct 176 ms 67748 KB Output is correct
23 Correct 258 ms 96108 KB Output is correct
24 Correct 269 ms 96056 KB Output is correct
25 Correct 28 ms 11168 KB Output is correct
26 Correct 28 ms 11156 KB Output is correct
27 Correct 2 ms 1232 KB Output is correct
28 Correct 5 ms 1664 KB Output is correct
29 Correct 4 ms 1616 KB Output is correct
30 Correct 1 ms 512 KB Output is correct
31 Correct 2 ms 464 KB Output is correct
32 Correct 3 ms 1232 KB Output is correct
33 Correct 3 ms 1564 KB Output is correct
34 Correct 3 ms 1616 KB Output is correct
35 Correct 1 ms 464 KB Output is correct
36 Correct 1 ms 464 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 291 ms 14860 KB Output is correct
2 Correct 1075 ms 67796 KB Output is correct
3 Correct 929 ms 67788 KB Output is correct
4 Correct 1109 ms 96136 KB Output is correct
5 Correct 949 ms 96068 KB Output is correct
6 Correct 1031 ms 96020 KB Output is correct
7 Correct 1171 ms 96068 KB Output is correct
8 Correct 971 ms 11176 KB Output is correct
9 Correct 880 ms 11208 KB Output is correct
10 Correct 782 ms 11196 KB Output is correct
11 Correct 995 ms 11172 KB Output is correct
12 Correct 210 ms 67684 KB Output is correct
13 Correct 269 ms 96020 KB Output is correct
14 Correct 305 ms 96052 KB Output is correct
15 Correct 26 ms 11152 KB Output is correct
16 Correct 28 ms 11164 KB Output is correct
17 Correct 196 ms 65460 KB Output is correct
18 Correct 190 ms 67880 KB Output is correct
19 Correct 186 ms 68008 KB Output is correct
20 Correct 279 ms 96028 KB Output is correct
21 Correct 289 ms 96048 KB Output is correct
22 Correct 276 ms 96184 KB Output is correct
23 Correct 252 ms 96108 KB Output is correct
24 Correct 30 ms 11224 KB Output is correct
25 Correct 37 ms 11188 KB Output is correct
26 Correct 27 ms 11180 KB Output is correct
27 Correct 29 ms 11160 KB Output is correct
28 Correct 2 ms 1232 KB Output is correct
29 Correct 3 ms 1616 KB Output is correct
30 Correct 5 ms 1616 KB Output is correct
31 Correct 1 ms 408 KB Output is correct
32 Correct 1 ms 464 KB Output is correct
33 Correct 2 ms 592 KB Output is correct
34 Correct 3 ms 1232 KB Output is correct
35 Correct 2 ms 1232 KB Output is correct
36 Correct 5 ms 1616 KB Output is correct
37 Correct 5 ms 1616 KB Output is correct
38 Correct 3 ms 1616 KB Output is correct
39 Correct 5 ms 1616 KB Output is correct
40 Correct 1 ms 464 KB Output is correct
41 Correct 2 ms 464 KB Output is correct
42 Correct 1 ms 464 KB Output is correct
43 Correct 1 ms 464 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 464 KB Output is correct
2 Correct 3 ms 1232 KB Output is correct
3 Correct 2 ms 1232 KB Output is correct
4 Correct 4 ms 1616 KB Output is correct
5 Correct 3 ms 1664 KB Output is correct
6 Correct 5 ms 1616 KB Output is correct
7 Correct 4 ms 1616 KB Output is correct
8 Correct 1 ms 464 KB Output is correct
9 Correct 1 ms 464 KB Output is correct
10 Correct 1 ms 464 KB Output is correct
11 Correct 1 ms 464 KB Output is correct
12 Correct 0 ms 208 KB Output is correct
13 Correct 1 ms 464 KB Output is correct
14 Correct 2 ms 464 KB Output is correct
15 Correct 3 ms 1232 KB Output is correct
16 Correct 3 ms 1616 KB Output is correct
17 Correct 4 ms 1560 KB Output is correct
18 Correct 1 ms 464 KB Output is correct
19 Correct 1 ms 464 KB Output is correct
20 Correct 2 ms 1232 KB Output is correct
21 Correct 3 ms 1628 KB Output is correct
22 Correct 5 ms 1616 KB Output is correct
23 Correct 1 ms 464 KB Output is correct
24 Correct 1 ms 464 KB Output is correct
25 Correct 2 ms 592 KB Output is correct
26 Correct 3 ms 1232 KB Output is correct
27 Correct 3 ms 1232 KB Output is correct
28 Correct 3 ms 1616 KB Output is correct
29 Correct 4 ms 1616 KB Output is correct
30 Correct 3 ms 1656 KB Output is correct
31 Correct 3 ms 1616 KB Output is correct
32 Correct 1 ms 464 KB Output is correct
33 Correct 1 ms 464 KB Output is correct
34 Correct 1 ms 512 KB Output is correct
35 Correct 1 ms 464 KB Output is correct
36 Correct 111 ms 42688 KB Output is correct
37 Correct 181 ms 67984 KB Output is correct
38 Correct 200 ms 67728 KB Output is correct
39 Correct 267 ms 96120 KB Output is correct
40 Correct 267 ms 96160 KB Output is correct
41 Correct 271 ms 96064 KB Output is correct
42 Correct 269 ms 96096 KB Output is correct
43 Correct 33 ms 11184 KB Output is correct
44 Correct 26 ms 11176 KB Output is correct
45 Correct 28 ms 11164 KB Output is correct
46 Correct 26 ms 11164 KB Output is correct
47 Correct 198 ms 67668 KB Output is correct
48 Correct 265 ms 96012 KB Output is correct
49 Correct 290 ms 96016 KB Output is correct
50 Correct 28 ms 11204 KB Output is correct
51 Correct 27 ms 11224 KB Output is correct
52 Correct 201 ms 67676 KB Output is correct
53 Correct 274 ms 96020 KB Output is correct
54 Correct 292 ms 96028 KB Output is correct
55 Correct 24 ms 11160 KB Output is correct
56 Correct 30 ms 11164 KB Output is correct
57 Correct 194 ms 65440 KB Output is correct
58 Correct 197 ms 67772 KB Output is correct
59 Correct 241 ms 67924 KB Output is correct
60 Correct 261 ms 96052 KB Output is correct
61 Correct 271 ms 96096 KB Output is correct
62 Correct 278 ms 96076 KB Output is correct
63 Correct 274 ms 96112 KB Output is correct
64 Correct 33 ms 11220 KB Output is correct
65 Correct 27 ms 11208 KB Output is correct
66 Correct 34 ms 11192 KB Output is correct
67 Correct 28 ms 11156 KB Output is correct
68 Correct 1062 ms 67112 KB Output is correct
69 Correct 1213 ms 67908 KB Output is correct
70 Correct 1236 ms 67888 KB Output is correct
71 Correct 1499 ms 96036 KB Output is correct
72 Correct 1559 ms 96068 KB Output is correct
73 Correct 1397 ms 96096 KB Output is correct
74 Correct 1083 ms 96076 KB Output is correct
75 Correct 1130 ms 11184 KB Output is correct
76 Correct 943 ms 11160 KB Output is correct
77 Correct 1165 ms 11156 KB Output is correct
78 Correct 1127 ms 11184 KB Output is correct
79 Correct 1135 ms 11180 KB Output is correct
80 Correct 1026 ms 11148 KB Output is correct
81 Correct 0 ms 208 KB Output is correct
82 Correct 1 ms 464 KB Output is correct
83 Correct 1 ms 464 KB Output is correct
84 Correct 210 ms 67732 KB Output is correct
85 Correct 259 ms 96128 KB Output is correct
86 Correct 268 ms 96076 KB Output is correct
87 Correct 27 ms 11152 KB Output is correct
88 Correct 26 ms 11180 KB Output is correct
89 Correct 176 ms 67748 KB Output is correct
90 Correct 258 ms 96108 KB Output is correct
91 Correct 269 ms 96056 KB Output is correct
92 Correct 28 ms 11168 KB Output is correct
93 Correct 28 ms 11156 KB Output is correct
94 Correct 2 ms 1232 KB Output is correct
95 Correct 5 ms 1664 KB Output is correct
96 Correct 4 ms 1616 KB Output is correct
97 Correct 1 ms 512 KB Output is correct
98 Correct 2 ms 464 KB Output is correct
99 Correct 3 ms 1232 KB Output is correct
100 Correct 3 ms 1564 KB Output is correct
101 Correct 3 ms 1616 KB Output is correct
102 Correct 1 ms 464 KB Output is correct
103 Correct 1 ms 464 KB Output is correct
104 Correct 959 ms 59896 KB Output is correct
105 Correct 1186 ms 67748 KB Output is correct
106 Correct 1316 ms 68004 KB Output is correct
107 Correct 1399 ms 96084 KB Output is correct
108 Correct 1361 ms 96064 KB Output is correct
109 Correct 1373 ms 96052 KB Output is correct
110 Correct 1209 ms 96080 KB Output is correct
111 Correct 1018 ms 11156 KB Output is correct
112 Correct 1012 ms 11160 KB Output is correct
113 Correct 1044 ms 11160 KB Output is correct
114 Correct 1027 ms 11208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 582 ms 6816 KB Output is correct
2 Correct 1138 ms 11208 KB Output is correct
3 Correct 1200 ms 11180 KB Output is correct
4 Correct 1012 ms 11220 KB Output is correct
5 Correct 902 ms 11168 KB Output is correct
6 Correct 1122 ms 11280 KB Output is correct
7 Correct 1029 ms 11180 KB Output is correct
8 Correct 0 ms 208 KB Output is correct
9 Correct 1 ms 464 KB Output is correct
10 Correct 1 ms 464 KB Output is correct
11 Correct 1 ms 464 KB Output is correct
12 Correct 3 ms 1232 KB Output is correct
13 Correct 2 ms 1232 KB Output is correct
14 Correct 4 ms 1616 KB Output is correct
15 Correct 3 ms 1664 KB Output is correct
16 Correct 5 ms 1616 KB Output is correct
17 Correct 4 ms 1616 KB Output is correct
18 Correct 1 ms 464 KB Output is correct
19 Correct 1 ms 464 KB Output is correct
20 Correct 1 ms 464 KB Output is correct
21 Correct 1 ms 464 KB Output is correct
22 Correct 0 ms 208 KB Output is correct
23 Correct 1 ms 464 KB Output is correct
24 Correct 2 ms 464 KB Output is correct
25 Correct 3 ms 1232 KB Output is correct
26 Correct 3 ms 1616 KB Output is correct
27 Correct 4 ms 1560 KB Output is correct
28 Correct 1 ms 464 KB Output is correct
29 Correct 1 ms 464 KB Output is correct
30 Correct 2 ms 1232 KB Output is correct
31 Correct 3 ms 1628 KB Output is correct
32 Correct 5 ms 1616 KB Output is correct
33 Correct 1 ms 464 KB Output is correct
34 Correct 1 ms 464 KB Output is correct
35 Correct 2 ms 592 KB Output is correct
36 Correct 3 ms 1232 KB Output is correct
37 Correct 3 ms 1232 KB Output is correct
38 Correct 3 ms 1616 KB Output is correct
39 Correct 4 ms 1616 KB Output is correct
40 Correct 3 ms 1656 KB Output is correct
41 Correct 3 ms 1616 KB Output is correct
42 Correct 1 ms 464 KB Output is correct
43 Correct 1 ms 464 KB Output is correct
44 Correct 1 ms 512 KB Output is correct
45 Correct 1 ms 464 KB Output is correct
46 Correct 111 ms 42688 KB Output is correct
47 Correct 181 ms 67984 KB Output is correct
48 Correct 200 ms 67728 KB Output is correct
49 Correct 267 ms 96120 KB Output is correct
50 Correct 267 ms 96160 KB Output is correct
51 Correct 271 ms 96064 KB Output is correct
52 Correct 269 ms 96096 KB Output is correct
53 Correct 33 ms 11184 KB Output is correct
54 Correct 26 ms 11176 KB Output is correct
55 Correct 28 ms 11164 KB Output is correct
56 Correct 26 ms 11164 KB Output is correct
57 Correct 198 ms 67668 KB Output is correct
58 Correct 265 ms 96012 KB Output is correct
59 Correct 290 ms 96016 KB Output is correct
60 Correct 28 ms 11204 KB Output is correct
61 Correct 27 ms 11224 KB Output is correct
62 Correct 201 ms 67676 KB Output is correct
63 Correct 274 ms 96020 KB Output is correct
64 Correct 292 ms 96028 KB Output is correct
65 Correct 24 ms 11160 KB Output is correct
66 Correct 30 ms 11164 KB Output is correct
67 Correct 194 ms 65440 KB Output is correct
68 Correct 197 ms 67772 KB Output is correct
69 Correct 241 ms 67924 KB Output is correct
70 Correct 261 ms 96052 KB Output is correct
71 Correct 271 ms 96096 KB Output is correct
72 Correct 278 ms 96076 KB Output is correct
73 Correct 274 ms 96112 KB Output is correct
74 Correct 33 ms 11220 KB Output is correct
75 Correct 27 ms 11208 KB Output is correct
76 Correct 34 ms 11192 KB Output is correct
77 Correct 28 ms 11156 KB Output is correct
78 Correct 1062 ms 67112 KB Output is correct
79 Correct 1213 ms 67908 KB Output is correct
80 Correct 1236 ms 67888 KB Output is correct
81 Correct 1499 ms 96036 KB Output is correct
82 Correct 1559 ms 96068 KB Output is correct
83 Correct 1397 ms 96096 KB Output is correct
84 Correct 1083 ms 96076 KB Output is correct
85 Correct 1130 ms 11184 KB Output is correct
86 Correct 943 ms 11160 KB Output is correct
87 Correct 1165 ms 11156 KB Output is correct
88 Correct 1127 ms 11184 KB Output is correct
89 Correct 1135 ms 11180 KB Output is correct
90 Correct 1026 ms 11148 KB Output is correct
91 Correct 0 ms 208 KB Output is correct
92 Correct 1 ms 464 KB Output is correct
93 Correct 1 ms 464 KB Output is correct
94 Correct 210 ms 67732 KB Output is correct
95 Correct 259 ms 96128 KB Output is correct
96 Correct 268 ms 96076 KB Output is correct
97 Correct 27 ms 11152 KB Output is correct
98 Correct 26 ms 11180 KB Output is correct
99 Correct 176 ms 67748 KB Output is correct
100 Correct 258 ms 96108 KB Output is correct
101 Correct 269 ms 96056 KB Output is correct
102 Correct 28 ms 11168 KB Output is correct
103 Correct 28 ms 11156 KB Output is correct
104 Correct 2 ms 1232 KB Output is correct
105 Correct 5 ms 1664 KB Output is correct
106 Correct 4 ms 1616 KB Output is correct
107 Correct 1 ms 512 KB Output is correct
108 Correct 2 ms 464 KB Output is correct
109 Correct 3 ms 1232 KB Output is correct
110 Correct 3 ms 1564 KB Output is correct
111 Correct 3 ms 1616 KB Output is correct
112 Correct 1 ms 464 KB Output is correct
113 Correct 1 ms 464 KB Output is correct
114 Correct 291 ms 14860 KB Output is correct
115 Correct 1075 ms 67796 KB Output is correct
116 Correct 929 ms 67788 KB Output is correct
117 Correct 1109 ms 96136 KB Output is correct
118 Correct 949 ms 96068 KB Output is correct
119 Correct 1031 ms 96020 KB Output is correct
120 Correct 1171 ms 96068 KB Output is correct
121 Correct 971 ms 11176 KB Output is correct
122 Correct 880 ms 11208 KB Output is correct
123 Correct 782 ms 11196 KB Output is correct
124 Correct 995 ms 11172 KB Output is correct
125 Correct 210 ms 67684 KB Output is correct
126 Correct 269 ms 96020 KB Output is correct
127 Correct 305 ms 96052 KB Output is correct
128 Correct 26 ms 11152 KB Output is correct
129 Correct 28 ms 11164 KB Output is correct
130 Correct 196 ms 65460 KB Output is correct
131 Correct 190 ms 67880 KB Output is correct
132 Correct 186 ms 68008 KB Output is correct
133 Correct 279 ms 96028 KB Output is correct
134 Correct 289 ms 96048 KB Output is correct
135 Correct 276 ms 96184 KB Output is correct
136 Correct 252 ms 96108 KB Output is correct
137 Correct 30 ms 11224 KB Output is correct
138 Correct 37 ms 11188 KB Output is correct
139 Correct 27 ms 11180 KB Output is correct
140 Correct 29 ms 11160 KB Output is correct
141 Correct 2 ms 1232 KB Output is correct
142 Correct 3 ms 1616 KB Output is correct
143 Correct 5 ms 1616 KB Output is correct
144 Correct 1 ms 408 KB Output is correct
145 Correct 1 ms 464 KB Output is correct
146 Correct 2 ms 592 KB Output is correct
147 Correct 3 ms 1232 KB Output is correct
148 Correct 2 ms 1232 KB Output is correct
149 Correct 5 ms 1616 KB Output is correct
150 Correct 5 ms 1616 KB Output is correct
151 Correct 3 ms 1616 KB Output is correct
152 Correct 5 ms 1616 KB Output is correct
153 Correct 1 ms 464 KB Output is correct
154 Correct 2 ms 464 KB Output is correct
155 Correct 1 ms 464 KB Output is correct
156 Correct 1 ms 464 KB Output is correct
157 Correct 959 ms 59896 KB Output is correct
158 Correct 1186 ms 67748 KB Output is correct
159 Correct 1316 ms 68004 KB Output is correct
160 Correct 1399 ms 96084 KB Output is correct
161 Correct 1361 ms 96064 KB Output is correct
162 Correct 1373 ms 96052 KB Output is correct
163 Correct 1209 ms 96080 KB Output is correct
164 Correct 1018 ms 11156 KB Output is correct
165 Correct 1012 ms 11160 KB Output is correct
166 Correct 1044 ms 11160 KB Output is correct
167 Correct 1027 ms 11208 KB Output is correct
168 Correct 0 ms 208 KB Output is correct
169 Correct 792 ms 21984 KB Output is correct
170 Correct 1484 ms 67464 KB Output is correct
171 Correct 1415 ms 67572 KB Output is correct
172 Correct 1909 ms 96088 KB Output is correct
173 Correct 1530 ms 96028 KB Output is correct
174 Correct 1738 ms 96044 KB Output is correct
175 Correct 1474 ms 96016 KB Output is correct
176 Correct 1044 ms 11184 KB Output is correct
177 Correct 1113 ms 11204 KB Output is correct
178 Correct 1109 ms 11164 KB Output is correct
179 Correct 976 ms 11192 KB Output is correct