답안 #728514

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
728514 2023-04-22T14:42:52 Z piOOE 푸드 코트 (JOI21_foodcourt) C++17
100 / 100
875 ms 61160 KB
#include <bits/stdc++.h>

using namespace std;
using ll = long long;

namespace SegmentTree {
    struct Info {
        ll sum = 0, mn = 0, mn2 = 3e18;
        int cntmn = 0, len = 0;
    };

    Info operator+(const Info &a, const Info &b) {
        Info res{};
        res.sum = a.sum + b.sum, res.len = a.len + b.len;
        res.mn = min(a.mn, b.mn);
        res.mn2 = min(a.mn == res.mn ? a.mn2 : a.mn, b.mn == res.mn ? b.mn2 : b.mn);
        res.cntmn = (a.mn == res.mn) * a.cntmn + (b.mn == res.mn) * b.cntmn;
        return res;
    }

    vector<Info> t;
    vector<ll> tag;
    int sz = 1;

    void pull(int x) {
        t[x] = t[x << 1] + t[x << 1 | 1];
    }

    void applyAdd(int x, ll tg) {
        tag[x] += tg;
        t[x].sum += t[x].len * tg;
        t[x].mn += tg, t[x].mn2 += tg;
    }

    void applyMin(int x, ll d) {
        if (t[x].mn < d) {
            assert(t[x].mn2 > d);
            t[x].sum += t[x].cntmn * (d - t[x].mn);
            t[x].mn = d;
        }
    }

    void push(int x) {
        if (tag[x]) {
            applyAdd(x << 1, tag[x]);
            applyAdd(x << 1 | 1, tag[x]);
            tag[x] = 0;
        }
        applyMin(x << 1, t[x].mn);
        applyMin(x << 1 | 1, t[x].mn);
    }

    void init(int n) {
        sz = 1 << __lg(n) + !!(n & (n - 1));
        t.assign(sz << 1, {}), tag.assign(sz << 1, {});

        for (int i = 0; i < n; ++i) {
            t[i + sz].cntmn = t[i + sz].len = 1;
        }
        for (int i = sz - 1; i > 0; --i) {
            pull(i);
        }
    }

    void rangeAdd(int l, int r, ll d, int x, int lx, int rx) {
        if (lx >= r || l >= rx) {
            return;
        }
        if (l <= lx && rx <= r) {
            return applyAdd(x, d);
        }
        push(x);
        int mid = (lx + rx) >> 1;
        rangeAdd(l, r, d, x << 1, lx, mid), rangeAdd(l, r, d, x << 1 | 1, mid, rx);
        pull(x);
    }

    void rangeSetMax(int l, int r, ll d, int x = 1, int lx = 0, int rx = sz) {
        if (l >= rx || lx >= r || t[x].mn >= d) {
            return;
        }
        if (l <= lx && rx <= r && t[x].mn2 > d) {
            return applyMin(x, d);
        }
        push(x);
        int mid = lx + rx >> 1;
        rangeSetMax(l, r, d, x << 1, lx, mid), rangeSetMax(l, r, d, x << 1 | 1, mid, rx);
        pull(x);
    }

    void rangeAdd(int l, int r, ll d) {
        rangeAdd(l, r, d, 1, 0, sz);
        rangeSetMax(0, sz, 0);
    }

    ll sum(int i, int x = 1, int lx = 0, int rx = sz) {
        while (x < sz) {
            push(x);
            int mid = lx + rx >> 1;
            if (i < mid) {
                x = x << 1;
                rx = mid;
            } else {
                x = x << 1 | 1;
                lx = mid;
            }
        }
        return t[x].sum;
    }
}

namespace SegmentTreeMin {
    constexpr int N_ = 1 << 19;

    pair<ll, int> t[N_]; // f(x) = max(0, x - t[i].first) + t[i].second
    ll tag[N_];
    int sz = 1;

    void init(int n) {
        sz = 1 << __lg(n) + !!(n & (n - 1));
        for (int i = 0; i < sz; ++i) {
            t[i + sz] = {i < n ? 0 : 3e18, i};
        }
        for (int i = sz - 1; i > 0; --i) {
            t[i] = min(t[i << 1], t[i << 1 | 1]);
        }
    }

    void apply(int x, ll d) {
        tag[x] += d, t[x].first += d;
    }

    void rangeAdd(int l, int r, ll a, int x = 1, int lx = 0, int rx = sz) {
        if (l >= rx || lx >= r) {
            return;
        }
        if (l <= lx && rx <= r) {
            return apply(x, a);
        }
        int mid = lx + rx >> 1;
        rangeAdd(l, r, a, x << 1, lx, mid), rangeAdd(l, r, a, x << 1 | 1, mid, rx);
        t[x] = min(t[x << 1], t[x << 1 | 1]);
        t[x].first += tag[x];
    }

    pair<ll, int> top() {
        return t[1];
    }
}

template<typename T>
struct Fenwick {
    int n;
    vector<T> a;

    Fenwick() = default;
    explicit Fenwick(int n) : n(n), a(n + 1) {}

    void modify(int x, T v) {
        for (int i = x + 1; i <= n; i += i & -i) {
            a[i] += v;
        }
    }

    void modify(int l, int r, T v) {
        if (l >= r) return;
        modify(l, v), modify(r, -v);
    }

    T sum(int x) {
        T ans = 0;
        for (int i = x + 1; i > 0; i -= i & -i) {
            ans += a[i];
        }
        return ans;
    }
};


constexpr int N = 2.5e5 + 10;

vector<pair<ll, int>> que[N];
int pnt[N];

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int n, m, q;
    cin >> n >> m >> q;

    struct Query {
        int t, l, r, c;
        ll k;
    };
    vector<Query> queries(q);

    Fenwick<ll> fn(n), fnAdd(n);
    SegmentTree::init(n);
    SegmentTreeMin::init(n);
    vector<ll> ans(q);

    for (int i = 0; i < q; ++i) {
        cin >> queries[i].t;

        if (queries[i].t == 1) {
            cin >> queries[i].l >> queries[i].r >> queries[i].c >> queries[i].k;
        } else if (queries[i].t == 2) {
            cin >> queries[i].l >> queries[i].r >> queries[i].k;
        } else {
            cin >> queries[i].l >> queries[i].k;
        }

        queries[i].l -= 1;

        if (queries[i].t == 1) {
            SegmentTree::rangeAdd(queries[i].l, queries[i].r, queries[i].k);
            fnAdd.modify(queries[i].l, queries[i].r, queries[i].k);
        } else if (queries[i].t == 2) {
            SegmentTree::rangeAdd(queries[i].l, queries[i].r, -queries[i].k);
            fn.modify(queries[i].l, queries[i].r, queries[i].k);
        } else {
            ll s = fn.sum(queries[i].l);
            ll have = SegmentTree::sum(queries[i].l) + s;
            ll need = queries[i].k + s;

            if (have >= need) {
                que[queries[i].l].emplace_back(fnAdd.sum(queries[i].l) - (have - s - queries[i].k), i);
            }
        }
    }

    auto relax = [&](int i) {
        if (pnt[i] == que[i].size()) {
            SegmentTreeMin::rangeAdd(i, i + 1, 3e18);
        } else {
            SegmentTreeMin::rangeAdd(i, i + 1, que[i][pnt[i]].first - (pnt[i] == 0 ? 0 : que[i][pnt[i] - 1].first));
        }
    };

    for (int i = 0; i < n; ++i) {
        sort(que[i].begin(), que[i].end());
        relax(i);
    }

    for (int i = 0; i < q; ++i) {
        if (queries[i].t == 1) {
            SegmentTreeMin::rangeAdd(queries[i].l, queries[i].r, -queries[i].k);
        }

        while (SegmentTreeMin::t[1].first <= 0) {
            int j = SegmentTreeMin::t[1].second;
            ans[que[j][pnt[j]].second] = queries[i].c;
            ++pnt[j];
            relax(j);
        }
    }

    for (int i = 0; i < q; ++i) {
        if (queries[i].t == 3) {
            cout << ans[i] << '\n';
        }
    }

    return 0;
}

Compilation message

foodcourt.cpp: In function 'void SegmentTree::init(int)':
foodcourt.cpp:54:27: warning: suggest parentheses around '+' inside '<<' [-Wparentheses]
   54 |         sz = 1 << __lg(n) + !!(n & (n - 1));
      |                   ~~~~~~~~^~~~~~~~~~~~~~~~~
foodcourt.cpp: In function 'void SegmentTree::rangeSetMax(int, int, ll, int, int, int)':
foodcourt.cpp:86:22: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   86 |         int mid = lx + rx >> 1;
      |                   ~~~^~~~
foodcourt.cpp: In function 'll SegmentTree::sum(int, int, int, int)':
foodcourt.cpp:99:26: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   99 |             int mid = lx + rx >> 1;
      |                       ~~~^~~~
foodcourt.cpp: In function 'void SegmentTreeMin::init(int)':
foodcourt.cpp:120:27: warning: suggest parentheses around '+' inside '<<' [-Wparentheses]
  120 |         sz = 1 << __lg(n) + !!(n & (n - 1));
      |                   ~~~~~~~~^~~~~~~~~~~~~~~~~
foodcourt.cpp: In function 'void SegmentTreeMin::rangeAdd(int, int, ll, int, int, int)':
foodcourt.cpp:140:22: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
  140 |         int mid = lx + rx >> 1;
      |                   ~~~^~~~
foodcourt.cpp: In lambda function:
foodcourt.cpp:234:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<long long int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  234 |         if (pnt[i] == que[i].size()) {
      |             ~~~~~~~^~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 6484 KB Output is correct
2 Correct 6 ms 6484 KB Output is correct
3 Correct 6 ms 6484 KB Output is correct
4 Correct 6 ms 6484 KB Output is correct
5 Correct 4 ms 6228 KB Output is correct
6 Correct 4 ms 6216 KB Output is correct
7 Correct 8 ms 6612 KB Output is correct
8 Correct 7 ms 6580 KB Output is correct
9 Correct 7 ms 6612 KB Output is correct
10 Correct 6 ms 6612 KB Output is correct
11 Correct 9 ms 6612 KB Output is correct
12 Correct 7 ms 6612 KB Output is correct
13 Correct 5 ms 6480 KB Output is correct
14 Correct 6 ms 6612 KB Output is correct
15 Correct 6 ms 6488 KB Output is correct
16 Correct 6 ms 6612 KB Output is correct
17 Correct 6 ms 6484 KB Output is correct
18 Correct 8 ms 6580 KB Output is correct
19 Correct 5 ms 6484 KB Output is correct
20 Correct 7 ms 6612 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 6484 KB Output is correct
2 Correct 6 ms 6484 KB Output is correct
3 Correct 6 ms 6484 KB Output is correct
4 Correct 6 ms 6484 KB Output is correct
5 Correct 4 ms 6228 KB Output is correct
6 Correct 4 ms 6216 KB Output is correct
7 Correct 8 ms 6612 KB Output is correct
8 Correct 7 ms 6580 KB Output is correct
9 Correct 7 ms 6612 KB Output is correct
10 Correct 6 ms 6612 KB Output is correct
11 Correct 9 ms 6612 KB Output is correct
12 Correct 7 ms 6612 KB Output is correct
13 Correct 5 ms 6480 KB Output is correct
14 Correct 6 ms 6612 KB Output is correct
15 Correct 6 ms 6488 KB Output is correct
16 Correct 6 ms 6612 KB Output is correct
17 Correct 6 ms 6484 KB Output is correct
18 Correct 8 ms 6580 KB Output is correct
19 Correct 5 ms 6484 KB Output is correct
20 Correct 7 ms 6612 KB Output is correct
21 Correct 7 ms 6604 KB Output is correct
22 Correct 6 ms 6612 KB Output is correct
23 Correct 6 ms 6612 KB Output is correct
24 Correct 6 ms 6604 KB Output is correct
25 Correct 4 ms 6216 KB Output is correct
26 Correct 4 ms 6228 KB Output is correct
27 Correct 6 ms 6612 KB Output is correct
28 Correct 7 ms 6612 KB Output is correct
29 Correct 9 ms 6608 KB Output is correct
30 Correct 7 ms 6736 KB Output is correct
31 Correct 7 ms 6604 KB Output is correct
32 Correct 7 ms 6604 KB Output is correct
33 Correct 5 ms 6612 KB Output is correct
34 Correct 7 ms 6608 KB Output is correct
35 Correct 6 ms 6612 KB Output is correct
36 Correct 6 ms 6612 KB Output is correct
37 Correct 6 ms 6484 KB Output is correct
38 Correct 7 ms 6720 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 116 ms 17444 KB Output is correct
2 Correct 136 ms 17348 KB Output is correct
3 Correct 126 ms 17476 KB Output is correct
4 Correct 118 ms 17364 KB Output is correct
5 Correct 131 ms 17472 KB Output is correct
6 Correct 128 ms 17480 KB Output is correct
7 Correct 22 ms 8408 KB Output is correct
8 Correct 24 ms 9116 KB Output is correct
9 Correct 118 ms 18880 KB Output is correct
10 Correct 133 ms 18604 KB Output is correct
11 Correct 126 ms 18880 KB Output is correct
12 Correct 167 ms 18620 KB Output is correct
13 Correct 97 ms 17880 KB Output is correct
14 Correct 119 ms 18940 KB Output is correct
15 Correct 103 ms 18148 KB Output is correct
16 Correct 124 ms 18872 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 609 ms 51816 KB Output is correct
2 Correct 497 ms 48840 KB Output is correct
3 Correct 633 ms 53396 KB Output is correct
4 Correct 486 ms 50304 KB Output is correct
5 Correct 515 ms 48508 KB Output is correct
6 Correct 728 ms 52896 KB Output is correct
7 Correct 95 ms 15224 KB Output is correct
8 Correct 119 ms 15908 KB Output is correct
9 Correct 760 ms 55756 KB Output is correct
10 Correct 714 ms 55776 KB Output is correct
11 Correct 636 ms 54524 KB Output is correct
12 Correct 660 ms 54456 KB Output is correct
13 Correct 605 ms 54408 KB Output is correct
14 Correct 761 ms 54484 KB Output is correct
15 Correct 707 ms 54408 KB Output is correct
16 Correct 760 ms 54536 KB Output is correct
17 Correct 875 ms 54920 KB Output is correct
18 Correct 782 ms 55052 KB Output is correct
19 Correct 773 ms 55000 KB Output is correct
20 Correct 808 ms 54940 KB Output is correct
21 Correct 825 ms 54928 KB Output is correct
22 Correct 761 ms 55016 KB Output is correct
23 Correct 747 ms 54916 KB Output is correct
24 Correct 685 ms 54968 KB Output is correct
25 Correct 463 ms 52000 KB Output is correct
26 Correct 470 ms 53636 KB Output is correct
27 Correct 527 ms 54560 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 6484 KB Output is correct
2 Correct 6 ms 6484 KB Output is correct
3 Correct 6 ms 6484 KB Output is correct
4 Correct 6 ms 6484 KB Output is correct
5 Correct 4 ms 6228 KB Output is correct
6 Correct 4 ms 6216 KB Output is correct
7 Correct 8 ms 6612 KB Output is correct
8 Correct 7 ms 6580 KB Output is correct
9 Correct 7 ms 6612 KB Output is correct
10 Correct 6 ms 6612 KB Output is correct
11 Correct 9 ms 6612 KB Output is correct
12 Correct 7 ms 6612 KB Output is correct
13 Correct 5 ms 6480 KB Output is correct
14 Correct 6 ms 6612 KB Output is correct
15 Correct 6 ms 6488 KB Output is correct
16 Correct 6 ms 6612 KB Output is correct
17 Correct 6 ms 6484 KB Output is correct
18 Correct 8 ms 6580 KB Output is correct
19 Correct 5 ms 6484 KB Output is correct
20 Correct 7 ms 6612 KB Output is correct
21 Correct 116 ms 17444 KB Output is correct
22 Correct 136 ms 17348 KB Output is correct
23 Correct 126 ms 17476 KB Output is correct
24 Correct 118 ms 17364 KB Output is correct
25 Correct 131 ms 17472 KB Output is correct
26 Correct 128 ms 17480 KB Output is correct
27 Correct 22 ms 8408 KB Output is correct
28 Correct 24 ms 9116 KB Output is correct
29 Correct 118 ms 18880 KB Output is correct
30 Correct 133 ms 18604 KB Output is correct
31 Correct 126 ms 18880 KB Output is correct
32 Correct 167 ms 18620 KB Output is correct
33 Correct 97 ms 17880 KB Output is correct
34 Correct 119 ms 18940 KB Output is correct
35 Correct 103 ms 18148 KB Output is correct
36 Correct 124 ms 18872 KB Output is correct
37 Correct 121 ms 18708 KB Output is correct
38 Correct 97 ms 18252 KB Output is correct
39 Correct 22 ms 8788 KB Output is correct
40 Correct 26 ms 9036 KB Output is correct
41 Correct 118 ms 19152 KB Output is correct
42 Correct 128 ms 19140 KB Output is correct
43 Correct 143 ms 19148 KB Output is correct
44 Correct 131 ms 19140 KB Output is correct
45 Correct 127 ms 19200 KB Output is correct
46 Correct 140 ms 19088 KB Output is correct
47 Correct 72 ms 18580 KB Output is correct
48 Correct 116 ms 18636 KB Output is correct
49 Correct 110 ms 17348 KB Output is correct
50 Correct 135 ms 18624 KB Output is correct
51 Correct 160 ms 19076 KB Output is correct
52 Correct 171 ms 19036 KB Output is correct
53 Correct 99 ms 17892 KB Output is correct
54 Correct 120 ms 18880 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 115 ms 18328 KB Output is correct
2 Correct 125 ms 18392 KB Output is correct
3 Correct 131 ms 18892 KB Output is correct
4 Correct 108 ms 17740 KB Output is correct
5 Correct 117 ms 18244 KB Output is correct
6 Correct 130 ms 18852 KB Output is correct
7 Correct 30 ms 8828 KB Output is correct
8 Correct 29 ms 9544 KB Output is correct
9 Correct 91 ms 19556 KB Output is correct
10 Correct 91 ms 18024 KB Output is correct
11 Correct 115 ms 19604 KB Output is correct
12 Correct 110 ms 19596 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 6484 KB Output is correct
2 Correct 6 ms 6484 KB Output is correct
3 Correct 6 ms 6484 KB Output is correct
4 Correct 6 ms 6484 KB Output is correct
5 Correct 4 ms 6228 KB Output is correct
6 Correct 4 ms 6216 KB Output is correct
7 Correct 8 ms 6612 KB Output is correct
8 Correct 7 ms 6580 KB Output is correct
9 Correct 7 ms 6612 KB Output is correct
10 Correct 6 ms 6612 KB Output is correct
11 Correct 9 ms 6612 KB Output is correct
12 Correct 7 ms 6612 KB Output is correct
13 Correct 5 ms 6480 KB Output is correct
14 Correct 6 ms 6612 KB Output is correct
15 Correct 6 ms 6488 KB Output is correct
16 Correct 6 ms 6612 KB Output is correct
17 Correct 6 ms 6484 KB Output is correct
18 Correct 8 ms 6580 KB Output is correct
19 Correct 5 ms 6484 KB Output is correct
20 Correct 7 ms 6612 KB Output is correct
21 Correct 7 ms 6604 KB Output is correct
22 Correct 6 ms 6612 KB Output is correct
23 Correct 6 ms 6612 KB Output is correct
24 Correct 6 ms 6604 KB Output is correct
25 Correct 4 ms 6216 KB Output is correct
26 Correct 4 ms 6228 KB Output is correct
27 Correct 6 ms 6612 KB Output is correct
28 Correct 7 ms 6612 KB Output is correct
29 Correct 9 ms 6608 KB Output is correct
30 Correct 7 ms 6736 KB Output is correct
31 Correct 7 ms 6604 KB Output is correct
32 Correct 7 ms 6604 KB Output is correct
33 Correct 5 ms 6612 KB Output is correct
34 Correct 7 ms 6608 KB Output is correct
35 Correct 6 ms 6612 KB Output is correct
36 Correct 6 ms 6612 KB Output is correct
37 Correct 6 ms 6484 KB Output is correct
38 Correct 7 ms 6720 KB Output is correct
39 Correct 116 ms 17444 KB Output is correct
40 Correct 136 ms 17348 KB Output is correct
41 Correct 126 ms 17476 KB Output is correct
42 Correct 118 ms 17364 KB Output is correct
43 Correct 131 ms 17472 KB Output is correct
44 Correct 128 ms 17480 KB Output is correct
45 Correct 22 ms 8408 KB Output is correct
46 Correct 24 ms 9116 KB Output is correct
47 Correct 118 ms 18880 KB Output is correct
48 Correct 133 ms 18604 KB Output is correct
49 Correct 126 ms 18880 KB Output is correct
50 Correct 167 ms 18620 KB Output is correct
51 Correct 97 ms 17880 KB Output is correct
52 Correct 119 ms 18940 KB Output is correct
53 Correct 103 ms 18148 KB Output is correct
54 Correct 124 ms 18872 KB Output is correct
55 Correct 121 ms 18708 KB Output is correct
56 Correct 97 ms 18252 KB Output is correct
57 Correct 22 ms 8788 KB Output is correct
58 Correct 26 ms 9036 KB Output is correct
59 Correct 118 ms 19152 KB Output is correct
60 Correct 128 ms 19140 KB Output is correct
61 Correct 143 ms 19148 KB Output is correct
62 Correct 131 ms 19140 KB Output is correct
63 Correct 127 ms 19200 KB Output is correct
64 Correct 140 ms 19088 KB Output is correct
65 Correct 72 ms 18580 KB Output is correct
66 Correct 116 ms 18636 KB Output is correct
67 Correct 110 ms 17348 KB Output is correct
68 Correct 135 ms 18624 KB Output is correct
69 Correct 160 ms 19076 KB Output is correct
70 Correct 171 ms 19036 KB Output is correct
71 Correct 99 ms 17892 KB Output is correct
72 Correct 120 ms 18880 KB Output is correct
73 Correct 115 ms 18328 KB Output is correct
74 Correct 125 ms 18392 KB Output is correct
75 Correct 131 ms 18892 KB Output is correct
76 Correct 108 ms 17740 KB Output is correct
77 Correct 117 ms 18244 KB Output is correct
78 Correct 130 ms 18852 KB Output is correct
79 Correct 30 ms 8828 KB Output is correct
80 Correct 29 ms 9544 KB Output is correct
81 Correct 91 ms 19556 KB Output is correct
82 Correct 91 ms 18024 KB Output is correct
83 Correct 115 ms 19604 KB Output is correct
84 Correct 110 ms 19596 KB Output is correct
85 Correct 123 ms 18872 KB Output is correct
86 Correct 130 ms 19708 KB Output is correct
87 Correct 120 ms 19116 KB Output is correct
88 Correct 132 ms 19728 KB Output is correct
89 Correct 88 ms 17908 KB Output is correct
90 Correct 131 ms 19740 KB Output is correct
91 Correct 110 ms 18184 KB Output is correct
92 Correct 105 ms 18116 KB Output is correct
93 Correct 137 ms 19652 KB Output is correct
94 Correct 126 ms 19660 KB Output is correct
95 Correct 118 ms 19376 KB Output is correct
96 Correct 135 ms 19628 KB Output is correct
97 Correct 146 ms 19588 KB Output is correct
98 Correct 117 ms 18468 KB Output is correct
99 Correct 79 ms 19152 KB Output is correct
100 Correct 94 ms 18380 KB Output is correct
101 Correct 113 ms 19196 KB Output is correct
102 Correct 112 ms 19560 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 6484 KB Output is correct
2 Correct 6 ms 6484 KB Output is correct
3 Correct 6 ms 6484 KB Output is correct
4 Correct 6 ms 6484 KB Output is correct
5 Correct 4 ms 6228 KB Output is correct
6 Correct 4 ms 6216 KB Output is correct
7 Correct 8 ms 6612 KB Output is correct
8 Correct 7 ms 6580 KB Output is correct
9 Correct 7 ms 6612 KB Output is correct
10 Correct 6 ms 6612 KB Output is correct
11 Correct 9 ms 6612 KB Output is correct
12 Correct 7 ms 6612 KB Output is correct
13 Correct 5 ms 6480 KB Output is correct
14 Correct 6 ms 6612 KB Output is correct
15 Correct 6 ms 6488 KB Output is correct
16 Correct 6 ms 6612 KB Output is correct
17 Correct 6 ms 6484 KB Output is correct
18 Correct 8 ms 6580 KB Output is correct
19 Correct 5 ms 6484 KB Output is correct
20 Correct 7 ms 6612 KB Output is correct
21 Correct 7 ms 6604 KB Output is correct
22 Correct 6 ms 6612 KB Output is correct
23 Correct 6 ms 6612 KB Output is correct
24 Correct 6 ms 6604 KB Output is correct
25 Correct 4 ms 6216 KB Output is correct
26 Correct 4 ms 6228 KB Output is correct
27 Correct 6 ms 6612 KB Output is correct
28 Correct 7 ms 6612 KB Output is correct
29 Correct 9 ms 6608 KB Output is correct
30 Correct 7 ms 6736 KB Output is correct
31 Correct 7 ms 6604 KB Output is correct
32 Correct 7 ms 6604 KB Output is correct
33 Correct 5 ms 6612 KB Output is correct
34 Correct 7 ms 6608 KB Output is correct
35 Correct 6 ms 6612 KB Output is correct
36 Correct 6 ms 6612 KB Output is correct
37 Correct 6 ms 6484 KB Output is correct
38 Correct 7 ms 6720 KB Output is correct
39 Correct 116 ms 17444 KB Output is correct
40 Correct 136 ms 17348 KB Output is correct
41 Correct 126 ms 17476 KB Output is correct
42 Correct 118 ms 17364 KB Output is correct
43 Correct 131 ms 17472 KB Output is correct
44 Correct 128 ms 17480 KB Output is correct
45 Correct 22 ms 8408 KB Output is correct
46 Correct 24 ms 9116 KB Output is correct
47 Correct 118 ms 18880 KB Output is correct
48 Correct 133 ms 18604 KB Output is correct
49 Correct 126 ms 18880 KB Output is correct
50 Correct 167 ms 18620 KB Output is correct
51 Correct 97 ms 17880 KB Output is correct
52 Correct 119 ms 18940 KB Output is correct
53 Correct 103 ms 18148 KB Output is correct
54 Correct 124 ms 18872 KB Output is correct
55 Correct 609 ms 51816 KB Output is correct
56 Correct 497 ms 48840 KB Output is correct
57 Correct 633 ms 53396 KB Output is correct
58 Correct 486 ms 50304 KB Output is correct
59 Correct 515 ms 48508 KB Output is correct
60 Correct 728 ms 52896 KB Output is correct
61 Correct 95 ms 15224 KB Output is correct
62 Correct 119 ms 15908 KB Output is correct
63 Correct 760 ms 55756 KB Output is correct
64 Correct 714 ms 55776 KB Output is correct
65 Correct 636 ms 54524 KB Output is correct
66 Correct 660 ms 54456 KB Output is correct
67 Correct 605 ms 54408 KB Output is correct
68 Correct 761 ms 54484 KB Output is correct
69 Correct 707 ms 54408 KB Output is correct
70 Correct 760 ms 54536 KB Output is correct
71 Correct 875 ms 54920 KB Output is correct
72 Correct 782 ms 55052 KB Output is correct
73 Correct 773 ms 55000 KB Output is correct
74 Correct 808 ms 54940 KB Output is correct
75 Correct 825 ms 54928 KB Output is correct
76 Correct 761 ms 55016 KB Output is correct
77 Correct 747 ms 54916 KB Output is correct
78 Correct 685 ms 54968 KB Output is correct
79 Correct 463 ms 52000 KB Output is correct
80 Correct 470 ms 53636 KB Output is correct
81 Correct 527 ms 54560 KB Output is correct
82 Correct 121 ms 18708 KB Output is correct
83 Correct 97 ms 18252 KB Output is correct
84 Correct 22 ms 8788 KB Output is correct
85 Correct 26 ms 9036 KB Output is correct
86 Correct 118 ms 19152 KB Output is correct
87 Correct 128 ms 19140 KB Output is correct
88 Correct 143 ms 19148 KB Output is correct
89 Correct 131 ms 19140 KB Output is correct
90 Correct 127 ms 19200 KB Output is correct
91 Correct 140 ms 19088 KB Output is correct
92 Correct 72 ms 18580 KB Output is correct
93 Correct 116 ms 18636 KB Output is correct
94 Correct 110 ms 17348 KB Output is correct
95 Correct 135 ms 18624 KB Output is correct
96 Correct 160 ms 19076 KB Output is correct
97 Correct 171 ms 19036 KB Output is correct
98 Correct 99 ms 17892 KB Output is correct
99 Correct 120 ms 18880 KB Output is correct
100 Correct 115 ms 18328 KB Output is correct
101 Correct 125 ms 18392 KB Output is correct
102 Correct 131 ms 18892 KB Output is correct
103 Correct 108 ms 17740 KB Output is correct
104 Correct 117 ms 18244 KB Output is correct
105 Correct 130 ms 18852 KB Output is correct
106 Correct 30 ms 8828 KB Output is correct
107 Correct 29 ms 9544 KB Output is correct
108 Correct 91 ms 19556 KB Output is correct
109 Correct 91 ms 18024 KB Output is correct
110 Correct 115 ms 19604 KB Output is correct
111 Correct 110 ms 19596 KB Output is correct
112 Correct 123 ms 18872 KB Output is correct
113 Correct 130 ms 19708 KB Output is correct
114 Correct 120 ms 19116 KB Output is correct
115 Correct 132 ms 19728 KB Output is correct
116 Correct 88 ms 17908 KB Output is correct
117 Correct 131 ms 19740 KB Output is correct
118 Correct 110 ms 18184 KB Output is correct
119 Correct 105 ms 18116 KB Output is correct
120 Correct 137 ms 19652 KB Output is correct
121 Correct 126 ms 19660 KB Output is correct
122 Correct 118 ms 19376 KB Output is correct
123 Correct 135 ms 19628 KB Output is correct
124 Correct 146 ms 19588 KB Output is correct
125 Correct 117 ms 18468 KB Output is correct
126 Correct 79 ms 19152 KB Output is correct
127 Correct 94 ms 18380 KB Output is correct
128 Correct 113 ms 19196 KB Output is correct
129 Correct 112 ms 19560 KB Output is correct
130 Correct 650 ms 59832 KB Output is correct
131 Correct 467 ms 53292 KB Output is correct
132 Correct 684 ms 59980 KB Output is correct
133 Correct 583 ms 58828 KB Output is correct
134 Correct 530 ms 57132 KB Output is correct
135 Correct 619 ms 59924 KB Output is correct
136 Correct 640 ms 61156 KB Output is correct
137 Correct 606 ms 61160 KB Output is correct
138 Correct 618 ms 59740 KB Output is correct
139 Correct 625 ms 59732 KB Output is correct
140 Correct 654 ms 59676 KB Output is correct
141 Correct 627 ms 59596 KB Output is correct
142 Correct 616 ms 59696 KB Output is correct
143 Correct 671 ms 59656 KB Output is correct
144 Correct 626 ms 59644 KB Output is correct
145 Correct 647 ms 59728 KB Output is correct
146 Correct 641 ms 59616 KB Output is correct
147 Correct 665 ms 59564 KB Output is correct
148 Correct 630 ms 59468 KB Output is correct
149 Correct 635 ms 59768 KB Output is correct
150 Correct 315 ms 57292 KB Output is correct
151 Correct 471 ms 57732 KB Output is correct
152 Correct 474 ms 57796 KB Output is correct
153 Correct 507 ms 59064 KB Output is correct