답안 #1074601

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1074601 2024-08-25T11:22:23 Z shmax 송신탑 (IOI22_towers) C++17
100 / 100
986 ms 46256 KB
#include "towers.h"
#include <bits/stdc++.h>

using namespace std;
#define bit(x, i) ((x >> i) & 1)
#define inf 2000'000'000LL
template<typename T>
using vec = vector<T>;


template<typename it>
struct SparseTable {

    using T = typename remove_reference<decltype(*declval<it>())>::type;
    vector<vector<T>> t;
    function<T(T, T)> f;
    vector<int> log;

    SparseTable() = default;

    SparseTable(it first, it last, function<T(T, T)> op) : t(1), f(op) {
        int n = distance(first, last);
        t.assign(32 - __builtin_clz(n), vector<T>(n));
        t[0].assign(first, last);
        log.resize(n + 1);
        for (int i = 2; i <= n; i++)
            log[i] = log[i / 2] + 1;

        for (int i = 1; i < t.size(); i++)
            for (int j = 0; j < n - (1 << i) + 1; j++)
                t[i][j] = f(t[i - 1][j], t[i - 1][j + (1 << (i - 1))]);
    }

    T get(int l, int r) {
        int h = log[r - l + 1];
        return f(t[h][l], t[h][r - (1 << h) + 1]);
    }
};


namespace STREE1 {
    struct node {
        int l, r;
        int sum;
    };
    vec<node> nodes;

    void fetch(int x) {
        int sm = 0;
        if (nodes[x].l != -1) {
            sm += nodes[nodes[x].l].sum;
        }
        if (nodes[x].r != -1) {
            sm += nodes[nodes[x].r].sum;
        }
        nodes[x].sum = sm;
    }

    int new_node() {
        nodes.push_back({-1, -1, 0});
        return nodes.size() - 1;
    }

    vec<int> roots;

    int build(int tl, int tr) {
        if (tl == tr) {
            int id = new_node();
            nodes[id].sum = 0;
            return id;
        }
        int id = new_node();
        int tm = (tl + tr) / 2;
        int l = build(tl, tm);
        int r = build(tm + 1, tr);
        nodes[id].l = l;
        nodes[id].r = r;
        fetch(id);
        return id;
    }

    int get(int v, int tl, int tr, int l, int r) {
        if (tl == l and tr == r) {
            return nodes[v].sum;
        }
        int tm = (tl + tr) / 2;
        if (r <= tm) {
            return get(nodes[v].l, tl, tm, l, r);
        }
        if (l > tm) {
            return get(nodes[v].r, tm + 1, tr, l, r);
        }
        return get(nodes[v].l, tl, tm, l, tm) + get(nodes[v].r, tm + 1, tr, tm + 1, r);
    }

    int update(int v, int tl, int tr, int pos, int x) {
        if (tl == tr) {
            int id = new_node();
            nodes[id].sum = x;
            return id;
        }
        int tm = (tl + tr) / 2;
        int id = new_node();
        if (pos <= tm) {
            int tid = update(nodes[v].l, tl, tm, pos, x);
            nodes[id].l = tid;
            nodes[id].r = nodes[v].r;
        } else {
            int tid = update(nodes[v].r, tm + 1, tr, pos, x);
            nodes[id].l = nodes[v].l;
            nodes[id].r = tid;
        }
        fetch(id);
        return id;
    }

    int find_left(int v, int tl, int tr, int l, int r) {
        if (nodes[v].sum == 0) return -1;
        if (tl == tr) {
            return tl;
        }
        int tm = (tl + tr) / 2;
        if (r <= tm) {
            return find_left(nodes[v].l, tl, tm, l, r);
        }
        if (l > tm) {
            return find_left(nodes[v].r, tm + 1, tr, l, r);
        }
        int res = find_left(nodes[v].l, tl, tm, l, tm);
        if (res == -1) {
            res = find_left(nodes[v].r, tm + 1, tr, tm + 1, r);
        }
        return res;
    }


    int find_right(int v, int tl, int tr, int l, int r) {
        if (nodes[v].sum == 0) return -1;
        if (tl == tr) {
            return tl;
        }
        int tm = (tl + tr) / 2;
        if (r <= tm) {
            return find_right(nodes[v].l, tl, tm, l, r);
        }
        if (l > tm) {
            return find_right(nodes[v].r, tm + 1, tr, l, r);
        }
        int res = find_right(nodes[v].r, tm + 1, tr, tm + 1, r);
        if (res == -1) {
            res = find_right(nodes[v].l, tl, tm, l, tm);
        }
        return res;
    }
}

namespace STREE2 {
    const int maxN = 1e5 + 5;
    struct node {
        int min, max;
        int min_diff;
        int max_diff;
    };

    node combine(node a, node b) {
        node res;
        res.min = min(a.min, b.min);
        res.max = max(a.max, b.max);
        res.min_diff = min(a.min_diff, b.min_diff);
        res.max_diff = max(a.max_diff, b.max_diff);
        res.min_diff = min(res.min_diff, b.min - a.max);
        res.max_diff = max(res.max_diff, b.max - a.min);
        return res;
    }

    node stree[4 * maxN];

    void build(int v, int tl, int tr, vec<int> &a) {
        if (tl == tr) {
            stree[v] = {a[tl], a[tl], 0, 0};
            return;
        }
        int tm = (tl + tr) / 2;
        build(2 * v, tl, tm, a);
        build(2 * v + 1, tm + 1, tr, a);
        stree[v] = combine(stree[2 * v], stree[2 * v + 1]);
    }

    node get(int v, int tl, int tr, int l, int r) {
        if (tl == l and tr == r) {
            return stree[v];
        }
        int tm = (tl + tr) / 2;
        if (r <= tm) {
            return get(2 * v, tl, tm, l, r);
        }
        if (l > tm) {
            return get(2 * v + 1, tm + 1, tr, l, r);
        }
        return combine(get(2 * v, tl, tm, l, tm), get(2 * v + 1, tm + 1, tr, tm + 1, r));
    }
}

vec<int> h;
int n;
vec<pair<int, int>> deltas;
SparseTable<vec<int>::iterator> stmin;
SparseTable<vec<int>::iterator> stmax;

void init(int N, std::vector<int> H) {
    n = N;
    h = H;
    stmin = SparseTable(h.begin(), h.end(), [](int a, int b) { return min(a, b); });
    stmax = SparseTable(h.begin(), h.end(), [](int a, int b) { return max(a, b); });
    for (int i = 0; i < n; i++) {
        int h1 = inf;
        if (i != 0) {
            if (stmin.get(0, i - 1) < h[i]) {
                int tl = 0;
                int tr = i - 1;
                while (tl != tr) {
                    int tm = (tl + tr + 1) / 2;
                    if (stmin.get(tm, i - 1) < h[i]) {
                        tl = tm;
                    } else {
                        tr = tm - 1;
                    }
                }
                h1 = stmax.get(tl, i - 1);
            }
        }
        int h2 = inf;
        if (i != n - 1) {
            if (stmin.get(i + 1, n - 1) < h[i]) {
                int tl = i + 1;
                int tr = n - 1;
                while (tl != tr) {
                    int tm = (tl + tr) / 2;
                    if (stmin.get(i + 1, tm) < h[i]) {
                        tr = tm;
                    } else {
                        tl = tm + 1;
                    }
                }
                h2 = stmax.get(i + 1, tr);
            }
        }
        int max_delta = min(h1, h2) - h[i];
        deltas.push_back({max_delta, i});
    }

    sort(deltas.rbegin(), deltas.rend());
    int t = STREE1::build(0, n - 1);
    STREE1::roots.push_back(t);
    for (auto [d, i]: deltas) {
        t = STREE1::update(STREE1::roots.back(), 0, n - 1, i, 1);
        STREE1::roots.push_back(t);
    }
    STREE2::build(1, 0, n - 1, h);
}

int max_towers(int L, int R, int D) {
    int tl = 0;
    int tr = n - 1;
    while (tl != tr) {
        int tm = (tl + tr + 1) / 2;
        if (deltas[tm].first >= D) {
            tl = tm;
        } else {
            tr = tm - 1;
        }
    }
    if (deltas[0].first < D)
        tl = -1;
    int vr = STREE1::roots[tl + 1];
    int ans = STREE1::get(vr, 0, n - 1, L, R);
    int pl = STREE1::find_left(vr, 0, n - 1, L, n - 1);
    int pr = STREE1::find_right(vr, 0, n - 1, 0, R);
    if (pl > L + 1) {
        tl = L;
        tr = pl - 1;
        while (tl != tr) {
            int tm = (tl + tr + 1) / 2;
            if (stmax.get(tm, pl - 1) + D >= h[pl]) {
                tl = tm;
            } else {
                tr = tm - 1;
            }
        }
        if (STREE2::get(1, 0, n - 1, L, tl).max_diff >= D)
            ans++;
    }
    if (pr < R - 1) {
        tl = pr + 1;
        tr = R;
        while (tl != tr) {
            int tm = (tl + tr) / 2;
            if (stmax.get(pr + 1, tm) + D >= h[pr]) {
                tr = tm;
            } else {
                tl = tm + 1;
            }
        }
        if (STREE2::get(1, 0, n - 1, tl, R).min_diff <= -D)
            ans++;
    }
    if (ans == 0)
        return 1;
    return ans;
}

Compilation message

towers.cpp: In instantiation of 'SparseTable<it>::SparseTable(it, it, std::function<typename std::remove_reference<decltype (* declval<it>())>::type(typename std::remove_reference<decltype (* declval<it>())>::type, typename std::remove_reference<decltype (* declval<it>())>::type)>) [with it = __gnu_cxx::__normal_iterator<int*, std::vector<int> >; typename std::remove_reference<decltype (* declval<it>())>::type = int]':
towers.cpp:213:83:   required from here
towers.cpp:29:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int>, std::allocator<std::vector<int> > >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |         for (int i = 1; i < t.size(); i++)
      |                         ~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 431 ms 35276 KB Output is correct
2 Correct 906 ms 45744 KB Output is correct
3 Correct 900 ms 44720 KB Output is correct
4 Correct 803 ms 45220 KB Output is correct
5 Correct 799 ms 44976 KB Output is correct
6 Correct 860 ms 44696 KB Output is correct
7 Correct 859 ms 44796 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 2 ms 1120 KB Output is correct
10 Correct 1 ms 1120 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 600 KB Output is correct
2 Correct 2 ms 1132 KB Output is correct
3 Correct 2 ms 1120 KB Output is correct
4 Correct 1 ms 1120 KB Output is correct
5 Correct 2 ms 1120 KB Output is correct
6 Correct 2 ms 1120 KB Output is correct
7 Correct 1 ms 1120 KB Output is correct
8 Correct 1 ms 1120 KB Output is correct
9 Correct 2 ms 1120 KB Output is correct
10 Correct 1 ms 1120 KB Output is correct
11 Correct 1 ms 1120 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 2 ms 1120 KB Output is correct
14 Correct 2 ms 1120 KB Output is correct
15 Correct 2 ms 1120 KB Output is correct
16 Correct 1 ms 1120 KB Output is correct
17 Correct 2 ms 1120 KB Output is correct
18 Correct 2 ms 1120 KB Output is correct
19 Correct 2 ms 1120 KB Output is correct
20 Correct 2 ms 1120 KB Output is correct
21 Correct 2 ms 1120 KB Output is correct
22 Correct 2 ms 1120 KB Output is correct
23 Correct 2 ms 1120 KB Output is correct
24 Correct 1 ms 1120 KB Output is correct
25 Correct 1 ms 852 KB Output is correct
26 Correct 2 ms 1120 KB Output is correct
27 Correct 2 ms 1120 KB Output is correct
28 Correct 2 ms 1120 KB Output is correct
29 Correct 2 ms 1120 KB Output is correct
30 Correct 2 ms 1120 KB Output is correct
31 Correct 2 ms 1120 KB Output is correct
32 Correct 1 ms 1120 KB Output is correct
33 Correct 1 ms 1120 KB Output is correct
34 Correct 2 ms 1120 KB Output is correct
35 Correct 1 ms 1120 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 600 KB Output is correct
2 Correct 2 ms 1132 KB Output is correct
3 Correct 2 ms 1120 KB Output is correct
4 Correct 1 ms 1120 KB Output is correct
5 Correct 2 ms 1120 KB Output is correct
6 Correct 2 ms 1120 KB Output is correct
7 Correct 1 ms 1120 KB Output is correct
8 Correct 1 ms 1120 KB Output is correct
9 Correct 2 ms 1120 KB Output is correct
10 Correct 1 ms 1120 KB Output is correct
11 Correct 1 ms 1120 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 2 ms 1120 KB Output is correct
14 Correct 2 ms 1120 KB Output is correct
15 Correct 2 ms 1120 KB Output is correct
16 Correct 1 ms 1120 KB Output is correct
17 Correct 2 ms 1120 KB Output is correct
18 Correct 2 ms 1120 KB Output is correct
19 Correct 2 ms 1120 KB Output is correct
20 Correct 2 ms 1120 KB Output is correct
21 Correct 2 ms 1120 KB Output is correct
22 Correct 2 ms 1120 KB Output is correct
23 Correct 2 ms 1120 KB Output is correct
24 Correct 1 ms 1120 KB Output is correct
25 Correct 1 ms 852 KB Output is correct
26 Correct 2 ms 1120 KB Output is correct
27 Correct 2 ms 1120 KB Output is correct
28 Correct 2 ms 1120 KB Output is correct
29 Correct 2 ms 1120 KB Output is correct
30 Correct 2 ms 1120 KB Output is correct
31 Correct 2 ms 1120 KB Output is correct
32 Correct 1 ms 1120 KB Output is correct
33 Correct 1 ms 1120 KB Output is correct
34 Correct 2 ms 1120 KB Output is correct
35 Correct 1 ms 1120 KB Output is correct
36 Correct 57 ms 37048 KB Output is correct
37 Correct 85 ms 45220 KB Output is correct
38 Correct 80 ms 46000 KB Output is correct
39 Correct 85 ms 44784 KB Output is correct
40 Correct 87 ms 44712 KB Output is correct
41 Correct 80 ms 44608 KB Output is correct
42 Correct 91 ms 45064 KB Output is correct
43 Correct 70 ms 44712 KB Output is correct
44 Correct 74 ms 45480 KB Output is correct
45 Correct 82 ms 44580 KB Output is correct
46 Correct 79 ms 45744 KB Output is correct
47 Correct 80 ms 44756 KB Output is correct
48 Correct 85 ms 44704 KB Output is correct
49 Correct 89 ms 44712 KB Output is correct
50 Correct 78 ms 44888 KB Output is correct
51 Correct 76 ms 45996 KB Output is correct
52 Correct 91 ms 44712 KB Output is correct
53 Correct 75 ms 44712 KB Output is correct
54 Correct 84 ms 45996 KB Output is correct
55 Correct 69 ms 45232 KB Output is correct
56 Correct 77 ms 45476 KB Output is correct
57 Correct 89 ms 43436 KB Output is correct
58 Correct 84 ms 44976 KB Output is correct
59 Correct 79 ms 45488 KB Output is correct
60 Correct 75 ms 44716 KB Output is correct
61 Correct 91 ms 44600 KB Output is correct
62 Correct 79 ms 45740 KB Output is correct
63 Correct 79 ms 44632 KB Output is correct
64 Correct 77 ms 46256 KB Output is correct
65 Correct 79 ms 44748 KB Output is correct
66 Correct 85 ms 45404 KB Output is correct
67 Correct 84 ms 44740 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 638 ms 44468 KB Output is correct
2 Correct 892 ms 45300 KB Output is correct
3 Correct 840 ms 44712 KB Output is correct
4 Correct 815 ms 44720 KB Output is correct
5 Correct 852 ms 44712 KB Output is correct
6 Correct 762 ms 44712 KB Output is correct
7 Correct 708 ms 44892 KB Output is correct
8 Correct 842 ms 44720 KB Output is correct
9 Correct 919 ms 46004 KB Output is correct
10 Correct 793 ms 44660 KB Output is correct
11 Correct 787 ms 44996 KB Output is correct
12 Correct 852 ms 45108 KB Output is correct
13 Correct 851 ms 44632 KB Output is correct
14 Correct 0 ms 344 KB Output is correct
15 Correct 2 ms 1120 KB Output is correct
16 Correct 3 ms 1120 KB Output is correct
17 Correct 83 ms 44960 KB Output is correct
18 Correct 87 ms 46024 KB Output is correct
19 Correct 115 ms 45716 KB Output is correct
20 Correct 106 ms 44776 KB Output is correct
21 Correct 74 ms 45744 KB Output is correct
22 Correct 92 ms 45168 KB Output is correct
23 Correct 92 ms 44696 KB Output is correct
24 Correct 92 ms 44816 KB Output is correct
25 Correct 79 ms 45044 KB Output is correct
26 Correct 106 ms 44976 KB Output is correct
27 Correct 2 ms 1120 KB Output is correct
28 Correct 2 ms 1120 KB Output is correct
29 Correct 2 ms 1120 KB Output is correct
30 Correct 3 ms 1120 KB Output is correct
31 Correct 2 ms 1120 KB Output is correct
32 Correct 2 ms 1120 KB Output is correct
33 Correct 2 ms 1120 KB Output is correct
34 Correct 2 ms 1120 KB Output is correct
35 Correct 2 ms 1120 KB Output is correct
36 Correct 2 ms 1120 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 164 ms 12096 KB Output is correct
2 Correct 825 ms 45396 KB Output is correct
3 Correct 780 ms 44692 KB Output is correct
4 Correct 825 ms 45152 KB Output is correct
5 Correct 828 ms 45488 KB Output is correct
6 Correct 803 ms 45232 KB Output is correct
7 Correct 774 ms 46000 KB Output is correct
8 Correct 794 ms 45812 KB Output is correct
9 Correct 696 ms 44744 KB Output is correct
10 Correct 742 ms 44968 KB Output is correct
11 Correct 766 ms 45992 KB Output is correct
12 Correct 77 ms 44696 KB Output is correct
13 Correct 77 ms 44720 KB Output is correct
14 Correct 75 ms 44744 KB Output is correct
15 Correct 69 ms 45232 KB Output is correct
16 Correct 74 ms 45688 KB Output is correct
17 Correct 112 ms 43392 KB Output is correct
18 Correct 77 ms 45356 KB Output is correct
19 Correct 79 ms 45736 KB Output is correct
20 Correct 83 ms 45728 KB Output is correct
21 Correct 82 ms 45736 KB Output is correct
22 Correct 76 ms 44716 KB Output is correct
23 Correct 78 ms 45156 KB Output is correct
24 Correct 75 ms 44800 KB Output is correct
25 Correct 71 ms 44952 KB Output is correct
26 Correct 74 ms 44716 KB Output is correct
27 Correct 69 ms 44716 KB Output is correct
28 Correct 1 ms 1120 KB Output is correct
29 Correct 1 ms 1120 KB Output is correct
30 Correct 1 ms 1120 KB Output is correct
31 Correct 1 ms 1120 KB Output is correct
32 Correct 1 ms 1120 KB Output is correct
33 Correct 1 ms 696 KB Output is correct
34 Correct 2 ms 1120 KB Output is correct
35 Correct 2 ms 1120 KB Output is correct
36 Correct 2 ms 1120 KB Output is correct
37 Correct 2 ms 1120 KB Output is correct
38 Correct 2 ms 1372 KB Output is correct
39 Correct 2 ms 1120 KB Output is correct
40 Correct 1 ms 1120 KB Output is correct
41 Correct 1 ms 1204 KB Output is correct
42 Correct 2 ms 1120 KB Output is correct
43 Correct 1 ms 1120 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 600 KB Output is correct
2 Correct 2 ms 1132 KB Output is correct
3 Correct 2 ms 1120 KB Output is correct
4 Correct 1 ms 1120 KB Output is correct
5 Correct 2 ms 1120 KB Output is correct
6 Correct 2 ms 1120 KB Output is correct
7 Correct 1 ms 1120 KB Output is correct
8 Correct 1 ms 1120 KB Output is correct
9 Correct 2 ms 1120 KB Output is correct
10 Correct 1 ms 1120 KB Output is correct
11 Correct 1 ms 1120 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 2 ms 1120 KB Output is correct
14 Correct 2 ms 1120 KB Output is correct
15 Correct 2 ms 1120 KB Output is correct
16 Correct 1 ms 1120 KB Output is correct
17 Correct 2 ms 1120 KB Output is correct
18 Correct 2 ms 1120 KB Output is correct
19 Correct 2 ms 1120 KB Output is correct
20 Correct 2 ms 1120 KB Output is correct
21 Correct 2 ms 1120 KB Output is correct
22 Correct 2 ms 1120 KB Output is correct
23 Correct 2 ms 1120 KB Output is correct
24 Correct 1 ms 1120 KB Output is correct
25 Correct 1 ms 852 KB Output is correct
26 Correct 2 ms 1120 KB Output is correct
27 Correct 2 ms 1120 KB Output is correct
28 Correct 2 ms 1120 KB Output is correct
29 Correct 2 ms 1120 KB Output is correct
30 Correct 2 ms 1120 KB Output is correct
31 Correct 2 ms 1120 KB Output is correct
32 Correct 1 ms 1120 KB Output is correct
33 Correct 1 ms 1120 KB Output is correct
34 Correct 2 ms 1120 KB Output is correct
35 Correct 1 ms 1120 KB Output is correct
36 Correct 57 ms 37048 KB Output is correct
37 Correct 85 ms 45220 KB Output is correct
38 Correct 80 ms 46000 KB Output is correct
39 Correct 85 ms 44784 KB Output is correct
40 Correct 87 ms 44712 KB Output is correct
41 Correct 80 ms 44608 KB Output is correct
42 Correct 91 ms 45064 KB Output is correct
43 Correct 70 ms 44712 KB Output is correct
44 Correct 74 ms 45480 KB Output is correct
45 Correct 82 ms 44580 KB Output is correct
46 Correct 79 ms 45744 KB Output is correct
47 Correct 80 ms 44756 KB Output is correct
48 Correct 85 ms 44704 KB Output is correct
49 Correct 89 ms 44712 KB Output is correct
50 Correct 78 ms 44888 KB Output is correct
51 Correct 76 ms 45996 KB Output is correct
52 Correct 91 ms 44712 KB Output is correct
53 Correct 75 ms 44712 KB Output is correct
54 Correct 84 ms 45996 KB Output is correct
55 Correct 69 ms 45232 KB Output is correct
56 Correct 77 ms 45476 KB Output is correct
57 Correct 89 ms 43436 KB Output is correct
58 Correct 84 ms 44976 KB Output is correct
59 Correct 79 ms 45488 KB Output is correct
60 Correct 75 ms 44716 KB Output is correct
61 Correct 91 ms 44600 KB Output is correct
62 Correct 79 ms 45740 KB Output is correct
63 Correct 79 ms 44632 KB Output is correct
64 Correct 77 ms 46256 KB Output is correct
65 Correct 79 ms 44748 KB Output is correct
66 Correct 85 ms 45404 KB Output is correct
67 Correct 84 ms 44740 KB Output is correct
68 Correct 638 ms 44468 KB Output is correct
69 Correct 892 ms 45300 KB Output is correct
70 Correct 840 ms 44712 KB Output is correct
71 Correct 815 ms 44720 KB Output is correct
72 Correct 852 ms 44712 KB Output is correct
73 Correct 762 ms 44712 KB Output is correct
74 Correct 708 ms 44892 KB Output is correct
75 Correct 842 ms 44720 KB Output is correct
76 Correct 919 ms 46004 KB Output is correct
77 Correct 793 ms 44660 KB Output is correct
78 Correct 787 ms 44996 KB Output is correct
79 Correct 852 ms 45108 KB Output is correct
80 Correct 851 ms 44632 KB Output is correct
81 Correct 0 ms 344 KB Output is correct
82 Correct 2 ms 1120 KB Output is correct
83 Correct 3 ms 1120 KB Output is correct
84 Correct 83 ms 44960 KB Output is correct
85 Correct 87 ms 46024 KB Output is correct
86 Correct 115 ms 45716 KB Output is correct
87 Correct 106 ms 44776 KB Output is correct
88 Correct 74 ms 45744 KB Output is correct
89 Correct 92 ms 45168 KB Output is correct
90 Correct 92 ms 44696 KB Output is correct
91 Correct 92 ms 44816 KB Output is correct
92 Correct 79 ms 45044 KB Output is correct
93 Correct 106 ms 44976 KB Output is correct
94 Correct 2 ms 1120 KB Output is correct
95 Correct 2 ms 1120 KB Output is correct
96 Correct 2 ms 1120 KB Output is correct
97 Correct 3 ms 1120 KB Output is correct
98 Correct 2 ms 1120 KB Output is correct
99 Correct 2 ms 1120 KB Output is correct
100 Correct 2 ms 1120 KB Output is correct
101 Correct 2 ms 1120 KB Output is correct
102 Correct 2 ms 1120 KB Output is correct
103 Correct 2 ms 1120 KB Output is correct
104 Correct 631 ms 41948 KB Output is correct
105 Correct 782 ms 45992 KB Output is correct
106 Correct 828 ms 46000 KB Output is correct
107 Correct 902 ms 44708 KB Output is correct
108 Correct 986 ms 45216 KB Output is correct
109 Correct 878 ms 44456 KB Output is correct
110 Correct 799 ms 44796 KB Output is correct
111 Correct 801 ms 45224 KB Output is correct
112 Correct 895 ms 44968 KB Output is correct
113 Correct 892 ms 45740 KB Output is correct
114 Correct 877 ms 44720 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 431 ms 35276 KB Output is correct
2 Correct 906 ms 45744 KB Output is correct
3 Correct 900 ms 44720 KB Output is correct
4 Correct 803 ms 45220 KB Output is correct
5 Correct 799 ms 44976 KB Output is correct
6 Correct 860 ms 44696 KB Output is correct
7 Correct 859 ms 44796 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 2 ms 1120 KB Output is correct
10 Correct 1 ms 1120 KB Output is correct
11 Correct 1 ms 600 KB Output is correct
12 Correct 2 ms 1132 KB Output is correct
13 Correct 2 ms 1120 KB Output is correct
14 Correct 1 ms 1120 KB Output is correct
15 Correct 2 ms 1120 KB Output is correct
16 Correct 2 ms 1120 KB Output is correct
17 Correct 1 ms 1120 KB Output is correct
18 Correct 1 ms 1120 KB Output is correct
19 Correct 2 ms 1120 KB Output is correct
20 Correct 1 ms 1120 KB Output is correct
21 Correct 1 ms 1120 KB Output is correct
22 Correct 0 ms 344 KB Output is correct
23 Correct 2 ms 1120 KB Output is correct
24 Correct 2 ms 1120 KB Output is correct
25 Correct 2 ms 1120 KB Output is correct
26 Correct 1 ms 1120 KB Output is correct
27 Correct 2 ms 1120 KB Output is correct
28 Correct 2 ms 1120 KB Output is correct
29 Correct 2 ms 1120 KB Output is correct
30 Correct 2 ms 1120 KB Output is correct
31 Correct 2 ms 1120 KB Output is correct
32 Correct 2 ms 1120 KB Output is correct
33 Correct 2 ms 1120 KB Output is correct
34 Correct 1 ms 1120 KB Output is correct
35 Correct 1 ms 852 KB Output is correct
36 Correct 2 ms 1120 KB Output is correct
37 Correct 2 ms 1120 KB Output is correct
38 Correct 2 ms 1120 KB Output is correct
39 Correct 2 ms 1120 KB Output is correct
40 Correct 2 ms 1120 KB Output is correct
41 Correct 2 ms 1120 KB Output is correct
42 Correct 1 ms 1120 KB Output is correct
43 Correct 1 ms 1120 KB Output is correct
44 Correct 2 ms 1120 KB Output is correct
45 Correct 1 ms 1120 KB Output is correct
46 Correct 57 ms 37048 KB Output is correct
47 Correct 85 ms 45220 KB Output is correct
48 Correct 80 ms 46000 KB Output is correct
49 Correct 85 ms 44784 KB Output is correct
50 Correct 87 ms 44712 KB Output is correct
51 Correct 80 ms 44608 KB Output is correct
52 Correct 91 ms 45064 KB Output is correct
53 Correct 70 ms 44712 KB Output is correct
54 Correct 74 ms 45480 KB Output is correct
55 Correct 82 ms 44580 KB Output is correct
56 Correct 79 ms 45744 KB Output is correct
57 Correct 80 ms 44756 KB Output is correct
58 Correct 85 ms 44704 KB Output is correct
59 Correct 89 ms 44712 KB Output is correct
60 Correct 78 ms 44888 KB Output is correct
61 Correct 76 ms 45996 KB Output is correct
62 Correct 91 ms 44712 KB Output is correct
63 Correct 75 ms 44712 KB Output is correct
64 Correct 84 ms 45996 KB Output is correct
65 Correct 69 ms 45232 KB Output is correct
66 Correct 77 ms 45476 KB Output is correct
67 Correct 89 ms 43436 KB Output is correct
68 Correct 84 ms 44976 KB Output is correct
69 Correct 79 ms 45488 KB Output is correct
70 Correct 75 ms 44716 KB Output is correct
71 Correct 91 ms 44600 KB Output is correct
72 Correct 79 ms 45740 KB Output is correct
73 Correct 79 ms 44632 KB Output is correct
74 Correct 77 ms 46256 KB Output is correct
75 Correct 79 ms 44748 KB Output is correct
76 Correct 85 ms 45404 KB Output is correct
77 Correct 84 ms 44740 KB Output is correct
78 Correct 638 ms 44468 KB Output is correct
79 Correct 892 ms 45300 KB Output is correct
80 Correct 840 ms 44712 KB Output is correct
81 Correct 815 ms 44720 KB Output is correct
82 Correct 852 ms 44712 KB Output is correct
83 Correct 762 ms 44712 KB Output is correct
84 Correct 708 ms 44892 KB Output is correct
85 Correct 842 ms 44720 KB Output is correct
86 Correct 919 ms 46004 KB Output is correct
87 Correct 793 ms 44660 KB Output is correct
88 Correct 787 ms 44996 KB Output is correct
89 Correct 852 ms 45108 KB Output is correct
90 Correct 851 ms 44632 KB Output is correct
91 Correct 0 ms 344 KB Output is correct
92 Correct 2 ms 1120 KB Output is correct
93 Correct 3 ms 1120 KB Output is correct
94 Correct 83 ms 44960 KB Output is correct
95 Correct 87 ms 46024 KB Output is correct
96 Correct 115 ms 45716 KB Output is correct
97 Correct 106 ms 44776 KB Output is correct
98 Correct 74 ms 45744 KB Output is correct
99 Correct 92 ms 45168 KB Output is correct
100 Correct 92 ms 44696 KB Output is correct
101 Correct 92 ms 44816 KB Output is correct
102 Correct 79 ms 45044 KB Output is correct
103 Correct 106 ms 44976 KB Output is correct
104 Correct 2 ms 1120 KB Output is correct
105 Correct 2 ms 1120 KB Output is correct
106 Correct 2 ms 1120 KB Output is correct
107 Correct 3 ms 1120 KB Output is correct
108 Correct 2 ms 1120 KB Output is correct
109 Correct 2 ms 1120 KB Output is correct
110 Correct 2 ms 1120 KB Output is correct
111 Correct 2 ms 1120 KB Output is correct
112 Correct 2 ms 1120 KB Output is correct
113 Correct 2 ms 1120 KB Output is correct
114 Correct 164 ms 12096 KB Output is correct
115 Correct 825 ms 45396 KB Output is correct
116 Correct 780 ms 44692 KB Output is correct
117 Correct 825 ms 45152 KB Output is correct
118 Correct 828 ms 45488 KB Output is correct
119 Correct 803 ms 45232 KB Output is correct
120 Correct 774 ms 46000 KB Output is correct
121 Correct 794 ms 45812 KB Output is correct
122 Correct 696 ms 44744 KB Output is correct
123 Correct 742 ms 44968 KB Output is correct
124 Correct 766 ms 45992 KB Output is correct
125 Correct 77 ms 44696 KB Output is correct
126 Correct 77 ms 44720 KB Output is correct
127 Correct 75 ms 44744 KB Output is correct
128 Correct 69 ms 45232 KB Output is correct
129 Correct 74 ms 45688 KB Output is correct
130 Correct 112 ms 43392 KB Output is correct
131 Correct 77 ms 45356 KB Output is correct
132 Correct 79 ms 45736 KB Output is correct
133 Correct 83 ms 45728 KB Output is correct
134 Correct 82 ms 45736 KB Output is correct
135 Correct 76 ms 44716 KB Output is correct
136 Correct 78 ms 45156 KB Output is correct
137 Correct 75 ms 44800 KB Output is correct
138 Correct 71 ms 44952 KB Output is correct
139 Correct 74 ms 44716 KB Output is correct
140 Correct 69 ms 44716 KB Output is correct
141 Correct 1 ms 1120 KB Output is correct
142 Correct 1 ms 1120 KB Output is correct
143 Correct 1 ms 1120 KB Output is correct
144 Correct 1 ms 1120 KB Output is correct
145 Correct 1 ms 1120 KB Output is correct
146 Correct 1 ms 696 KB Output is correct
147 Correct 2 ms 1120 KB Output is correct
148 Correct 2 ms 1120 KB Output is correct
149 Correct 2 ms 1120 KB Output is correct
150 Correct 2 ms 1120 KB Output is correct
151 Correct 2 ms 1372 KB Output is correct
152 Correct 2 ms 1120 KB Output is correct
153 Correct 1 ms 1120 KB Output is correct
154 Correct 1 ms 1204 KB Output is correct
155 Correct 2 ms 1120 KB Output is correct
156 Correct 1 ms 1120 KB Output is correct
157 Correct 631 ms 41948 KB Output is correct
158 Correct 782 ms 45992 KB Output is correct
159 Correct 828 ms 46000 KB Output is correct
160 Correct 902 ms 44708 KB Output is correct
161 Correct 986 ms 45216 KB Output is correct
162 Correct 878 ms 44456 KB Output is correct
163 Correct 799 ms 44796 KB Output is correct
164 Correct 801 ms 45224 KB Output is correct
165 Correct 895 ms 44968 KB Output is correct
166 Correct 892 ms 45740 KB Output is correct
167 Correct 877 ms 44720 KB Output is correct
168 Correct 0 ms 344 KB Output is correct
169 Correct 546 ms 19272 KB Output is correct
170 Correct 941 ms 45732 KB Output is correct
171 Correct 888 ms 45536 KB Output is correct
172 Correct 869 ms 44968 KB Output is correct
173 Correct 946 ms 45884 KB Output is correct
174 Correct 887 ms 45204 KB Output is correct
175 Correct 860 ms 44588 KB Output is correct
176 Correct 823 ms 44720 KB Output is correct
177 Correct 824 ms 45488 KB Output is correct
178 Correct 821 ms 44632 KB Output is correct
179 Correct 835 ms 45748 KB Output is correct