Submission #728521

# Submission time Handle Problem Language Result Execution time Memory
728521 2023-04-22T14:48:55 Z piOOE Food Court (JOI21_foodcourt) C++17
100 / 100
529 ms 44420 KB

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

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

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

    void init(int n) {
        sz = 1 << __lg(n) + !!(n & (n - 1));
    }

    void apply(int x, pair<ll, ll> d) {
        if (t[x].second >= d.first) {
            t[x] = {t[x].first, t[x].second - d.first + d.second};
        } else {
            t[x] = {t[x].first + d.first - t[x].second, d.second};
        }
    }

    void push(int x) {
        if (t[x].first || t[x].second) {
            apply(x << 1, t[x]), apply(x << 1 | 1, t[x]);
            t[x] = {};
        }
    }

    void rangeApply(int l, int r, pair<ll, 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);
        }
        push(x);
        int mid = lx + rx >> 1;
        rangeApply(l, r, a, x << 1, lx, mid), rangeApply(l, r, a, x << 1 | 1, mid, rx);
    }

    ll query(int x) {
        ll d = 0;
        for (x += sz; x >= 1; x >>= 1) {
            d = max(0LL, d - t[x].first) + t[x].second;
        }
        return d;
    }
}

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];
    }
}

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::rangeApply(queries[i].l, queries[i].r, {0, queries[i].k});
            fnAdd.modify(queries[i].l, queries[i].r, queries[i].k);
        } else if (queries[i].t == 2) {
            SegmentTree::rangeApply(queries[i].l, queries[i].r, {queries[i].k, 0});
            fn.modify(queries[i].l, queries[i].r, queries[i].k);
        } else {
            ll s = fn.sum(queries[i].l);
            ll have = SegmentTree::query(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:15:27: warning: suggest parentheses around '+' inside '<<' [-Wparentheses]
   15 |         sz = 1 << __lg(n) + !!(n & (n - 1));
      |                   ~~~~~~~~^~~~~~~~~~~~~~~~~
foodcourt.cpp: In function 'void SegmentTree::rangeApply(int, int, std::pair<long long int, long long int>, int, int, int)':
foodcourt.cpp:41:22: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   41 |         int mid = lx + rx >> 1;
      |                   ~~~^~~~
foodcourt.cpp: In function 'void SegmentTreeMin::init(int)':
foodcourt.cpp:62:27: warning: suggest parentheses around '+' inside '<<' [-Wparentheses]
   62 |         sz = 1 << __lg(n) + !!(n & (n - 1));
      |                   ~~~~~~~~^~~~~~~~~~~~~~~~~
foodcourt.cpp: In function 'void SegmentTreeMin::rangeAdd(int, int, ll, int, int, int)':
foodcourt.cpp:82:22: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   82 |         int mid = lx + rx >> 1;
      |                   ~~~^~~~
foodcourt.cpp: In lambda function:
foodcourt.cpp:172: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]
  172 |         if (pnt[i] == que[i].size()) {
      |             ~~~~~~~^~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 5 ms 6452 KB Output is correct
2 Correct 6 ms 6484 KB Output is correct
3 Correct 6 ms 6388 KB Output is correct
4 Correct 6 ms 6476 KB Output is correct
5 Correct 4 ms 6228 KB Output is correct
6 Correct 4 ms 6228 KB Output is correct
7 Correct 5 ms 6484 KB Output is correct
8 Correct 6 ms 6484 KB Output is correct
9 Correct 6 ms 6484 KB Output is correct
10 Correct 6 ms 6484 KB Output is correct
11 Correct 6 ms 6484 KB Output is correct
12 Correct 5 ms 6484 KB Output is correct
13 Correct 5 ms 6344 KB Output is correct
14 Correct 5 ms 6352 KB Output is correct
15 Correct 6 ms 6356 KB Output is correct
16 Correct 6 ms 6424 KB Output is correct
17 Correct 5 ms 6356 KB Output is correct
18 Correct 6 ms 6484 KB Output is correct
19 Correct 5 ms 6484 KB Output is correct
20 Correct 6 ms 6484 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 6452 KB Output is correct
2 Correct 6 ms 6484 KB Output is correct
3 Correct 6 ms 6388 KB Output is correct
4 Correct 6 ms 6476 KB Output is correct
5 Correct 4 ms 6228 KB Output is correct
6 Correct 4 ms 6228 KB Output is correct
7 Correct 5 ms 6484 KB Output is correct
8 Correct 6 ms 6484 KB Output is correct
9 Correct 6 ms 6484 KB Output is correct
10 Correct 6 ms 6484 KB Output is correct
11 Correct 6 ms 6484 KB Output is correct
12 Correct 5 ms 6484 KB Output is correct
13 Correct 5 ms 6344 KB Output is correct
14 Correct 5 ms 6352 KB Output is correct
15 Correct 6 ms 6356 KB Output is correct
16 Correct 6 ms 6424 KB Output is correct
17 Correct 5 ms 6356 KB Output is correct
18 Correct 6 ms 6484 KB Output is correct
19 Correct 5 ms 6484 KB Output is correct
20 Correct 6 ms 6484 KB Output is correct
21 Correct 6 ms 6484 KB Output is correct
22 Correct 6 ms 6484 KB Output is correct
23 Correct 6 ms 6484 KB Output is correct
24 Correct 6 ms 6484 KB Output is correct
25 Correct 5 ms 6216 KB Output is correct
26 Correct 4 ms 6216 KB Output is correct
27 Correct 6 ms 6624 KB Output is correct
28 Correct 6 ms 6484 KB Output is correct
29 Correct 7 ms 6488 KB Output is correct
30 Correct 6 ms 6484 KB Output is correct
31 Correct 6 ms 6476 KB Output is correct
32 Correct 6 ms 6492 KB Output is correct
33 Correct 5 ms 6344 KB Output is correct
34 Correct 6 ms 6356 KB Output is correct
35 Correct 6 ms 6476 KB Output is correct
36 Correct 6 ms 6448 KB Output is correct
37 Correct 7 ms 6372 KB Output is correct
38 Correct 7 ms 6484 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 64 ms 14328 KB Output is correct
2 Correct 82 ms 15004 KB Output is correct
3 Correct 85 ms 15000 KB Output is correct
4 Correct 68 ms 14924 KB Output is correct
5 Correct 77 ms 15028 KB Output is correct
6 Correct 71 ms 15028 KB Output is correct
7 Correct 24 ms 9000 KB Output is correct
8 Correct 22 ms 9072 KB Output is correct
9 Correct 68 ms 15248 KB Output is correct
10 Correct 73 ms 15004 KB Output is correct
11 Correct 74 ms 15180 KB Output is correct
12 Correct 71 ms 15520 KB Output is correct
13 Correct 62 ms 14128 KB Output is correct
14 Correct 79 ms 15848 KB Output is correct
15 Correct 72 ms 14520 KB Output is correct
16 Correct 75 ms 15772 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 425 ms 38208 KB Output is correct
2 Correct 329 ms 35788 KB Output is correct
3 Correct 465 ms 42640 KB Output is correct
4 Correct 397 ms 38832 KB Output is correct
5 Correct 394 ms 34952 KB Output is correct
6 Correct 529 ms 42180 KB Output is correct
7 Correct 97 ms 16500 KB Output is correct
8 Correct 92 ms 16432 KB Output is correct
9 Correct 483 ms 43500 KB Output is correct
10 Correct 490 ms 43468 KB Output is correct
11 Correct 471 ms 42236 KB Output is correct
12 Correct 454 ms 42272 KB Output is correct
13 Correct 457 ms 42200 KB Output is correct
14 Correct 490 ms 42156 KB Output is correct
15 Correct 467 ms 42128 KB Output is correct
16 Correct 482 ms 41688 KB Output is correct
17 Correct 461 ms 41180 KB Output is correct
18 Correct 467 ms 41208 KB Output is correct
19 Correct 511 ms 41164 KB Output is correct
20 Correct 475 ms 41108 KB Output is correct
21 Correct 465 ms 41124 KB Output is correct
22 Correct 479 ms 41136 KB Output is correct
23 Correct 471 ms 41272 KB Output is correct
24 Correct 479 ms 41116 KB Output is correct
25 Correct 342 ms 30416 KB Output is correct
26 Correct 350 ms 32068 KB Output is correct
27 Correct 377 ms 40736 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 6452 KB Output is correct
2 Correct 6 ms 6484 KB Output is correct
3 Correct 6 ms 6388 KB Output is correct
4 Correct 6 ms 6476 KB Output is correct
5 Correct 4 ms 6228 KB Output is correct
6 Correct 4 ms 6228 KB Output is correct
7 Correct 5 ms 6484 KB Output is correct
8 Correct 6 ms 6484 KB Output is correct
9 Correct 6 ms 6484 KB Output is correct
10 Correct 6 ms 6484 KB Output is correct
11 Correct 6 ms 6484 KB Output is correct
12 Correct 5 ms 6484 KB Output is correct
13 Correct 5 ms 6344 KB Output is correct
14 Correct 5 ms 6352 KB Output is correct
15 Correct 6 ms 6356 KB Output is correct
16 Correct 6 ms 6424 KB Output is correct
17 Correct 5 ms 6356 KB Output is correct
18 Correct 6 ms 6484 KB Output is correct
19 Correct 5 ms 6484 KB Output is correct
20 Correct 6 ms 6484 KB Output is correct
21 Correct 64 ms 14328 KB Output is correct
22 Correct 82 ms 15004 KB Output is correct
23 Correct 85 ms 15000 KB Output is correct
24 Correct 68 ms 14924 KB Output is correct
25 Correct 77 ms 15028 KB Output is correct
26 Correct 71 ms 15028 KB Output is correct
27 Correct 24 ms 9000 KB Output is correct
28 Correct 22 ms 9072 KB Output is correct
29 Correct 68 ms 15248 KB Output is correct
30 Correct 73 ms 15004 KB Output is correct
31 Correct 74 ms 15180 KB Output is correct
32 Correct 71 ms 15520 KB Output is correct
33 Correct 62 ms 14128 KB Output is correct
34 Correct 79 ms 15848 KB Output is correct
35 Correct 72 ms 14520 KB Output is correct
36 Correct 75 ms 15772 KB Output is correct
37 Correct 87 ms 15412 KB Output is correct
38 Correct 77 ms 15036 KB Output is correct
39 Correct 19 ms 8812 KB Output is correct
40 Correct 22 ms 9048 KB Output is correct
41 Correct 85 ms 16032 KB Output is correct
42 Correct 96 ms 16064 KB Output is correct
43 Correct 101 ms 16020 KB Output is correct
44 Correct 89 ms 16044 KB Output is correct
45 Correct 101 ms 16080 KB Output is correct
46 Correct 103 ms 15996 KB Output is correct
47 Correct 62 ms 13552 KB Output is correct
48 Correct 77 ms 13632 KB Output is correct
49 Correct 65 ms 13704 KB Output is correct
50 Correct 80 ms 15408 KB Output is correct
51 Correct 99 ms 15956 KB Output is correct
52 Correct 95 ms 16004 KB Output is correct
53 Correct 67 ms 14628 KB Output is correct
54 Correct 78 ms 15784 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 85 ms 14960 KB Output is correct
2 Correct 92 ms 15240 KB Output is correct
3 Correct 106 ms 15932 KB Output is correct
4 Correct 69 ms 14900 KB Output is correct
5 Correct 89 ms 15436 KB Output is correct
6 Correct 103 ms 16036 KB Output is correct
7 Correct 27 ms 9176 KB Output is correct
8 Correct 25 ms 8752 KB Output is correct
9 Correct 64 ms 13184 KB Output is correct
10 Correct 61 ms 12224 KB Output is correct
11 Correct 84 ms 13252 KB Output is correct
12 Correct 86 ms 13216 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 6452 KB Output is correct
2 Correct 6 ms 6484 KB Output is correct
3 Correct 6 ms 6388 KB Output is correct
4 Correct 6 ms 6476 KB Output is correct
5 Correct 4 ms 6228 KB Output is correct
6 Correct 4 ms 6228 KB Output is correct
7 Correct 5 ms 6484 KB Output is correct
8 Correct 6 ms 6484 KB Output is correct
9 Correct 6 ms 6484 KB Output is correct
10 Correct 6 ms 6484 KB Output is correct
11 Correct 6 ms 6484 KB Output is correct
12 Correct 5 ms 6484 KB Output is correct
13 Correct 5 ms 6344 KB Output is correct
14 Correct 5 ms 6352 KB Output is correct
15 Correct 6 ms 6356 KB Output is correct
16 Correct 6 ms 6424 KB Output is correct
17 Correct 5 ms 6356 KB Output is correct
18 Correct 6 ms 6484 KB Output is correct
19 Correct 5 ms 6484 KB Output is correct
20 Correct 6 ms 6484 KB Output is correct
21 Correct 6 ms 6484 KB Output is correct
22 Correct 6 ms 6484 KB Output is correct
23 Correct 6 ms 6484 KB Output is correct
24 Correct 6 ms 6484 KB Output is correct
25 Correct 5 ms 6216 KB Output is correct
26 Correct 4 ms 6216 KB Output is correct
27 Correct 6 ms 6624 KB Output is correct
28 Correct 6 ms 6484 KB Output is correct
29 Correct 7 ms 6488 KB Output is correct
30 Correct 6 ms 6484 KB Output is correct
31 Correct 6 ms 6476 KB Output is correct
32 Correct 6 ms 6492 KB Output is correct
33 Correct 5 ms 6344 KB Output is correct
34 Correct 6 ms 6356 KB Output is correct
35 Correct 6 ms 6476 KB Output is correct
36 Correct 6 ms 6448 KB Output is correct
37 Correct 7 ms 6372 KB Output is correct
38 Correct 7 ms 6484 KB Output is correct
39 Correct 64 ms 14328 KB Output is correct
40 Correct 82 ms 15004 KB Output is correct
41 Correct 85 ms 15000 KB Output is correct
42 Correct 68 ms 14924 KB Output is correct
43 Correct 77 ms 15028 KB Output is correct
44 Correct 71 ms 15028 KB Output is correct
45 Correct 24 ms 9000 KB Output is correct
46 Correct 22 ms 9072 KB Output is correct
47 Correct 68 ms 15248 KB Output is correct
48 Correct 73 ms 15004 KB Output is correct
49 Correct 74 ms 15180 KB Output is correct
50 Correct 71 ms 15520 KB Output is correct
51 Correct 62 ms 14128 KB Output is correct
52 Correct 79 ms 15848 KB Output is correct
53 Correct 72 ms 14520 KB Output is correct
54 Correct 75 ms 15772 KB Output is correct
55 Correct 87 ms 15412 KB Output is correct
56 Correct 77 ms 15036 KB Output is correct
57 Correct 19 ms 8812 KB Output is correct
58 Correct 22 ms 9048 KB Output is correct
59 Correct 85 ms 16032 KB Output is correct
60 Correct 96 ms 16064 KB Output is correct
61 Correct 101 ms 16020 KB Output is correct
62 Correct 89 ms 16044 KB Output is correct
63 Correct 101 ms 16080 KB Output is correct
64 Correct 103 ms 15996 KB Output is correct
65 Correct 62 ms 13552 KB Output is correct
66 Correct 77 ms 13632 KB Output is correct
67 Correct 65 ms 13704 KB Output is correct
68 Correct 80 ms 15408 KB Output is correct
69 Correct 99 ms 15956 KB Output is correct
70 Correct 95 ms 16004 KB Output is correct
71 Correct 67 ms 14628 KB Output is correct
72 Correct 78 ms 15784 KB Output is correct
73 Correct 85 ms 14960 KB Output is correct
74 Correct 92 ms 15240 KB Output is correct
75 Correct 106 ms 15932 KB Output is correct
76 Correct 69 ms 14900 KB Output is correct
77 Correct 89 ms 15436 KB Output is correct
78 Correct 103 ms 16036 KB Output is correct
79 Correct 27 ms 9176 KB Output is correct
80 Correct 25 ms 8752 KB Output is correct
81 Correct 64 ms 13184 KB Output is correct
82 Correct 61 ms 12224 KB Output is correct
83 Correct 84 ms 13252 KB Output is correct
84 Correct 86 ms 13216 KB Output is correct
85 Correct 87 ms 15424 KB Output is correct
86 Correct 96 ms 16628 KB Output is correct
87 Correct 102 ms 15872 KB Output is correct
88 Correct 114 ms 16716 KB Output is correct
89 Correct 69 ms 14404 KB Output is correct
90 Correct 91 ms 16600 KB Output is correct
91 Correct 76 ms 14468 KB Output is correct
92 Correct 76 ms 14284 KB Output is correct
93 Correct 115 ms 16588 KB Output is correct
94 Correct 99 ms 16564 KB Output is correct
95 Correct 92 ms 16116 KB Output is correct
96 Correct 101 ms 16640 KB Output is correct
97 Correct 98 ms 16612 KB Output is correct
98 Correct 87 ms 14736 KB Output is correct
99 Correct 60 ms 14152 KB Output is correct
100 Correct 69 ms 13292 KB Output is correct
101 Correct 88 ms 14208 KB Output is correct
102 Correct 80 ms 16452 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 6452 KB Output is correct
2 Correct 6 ms 6484 KB Output is correct
3 Correct 6 ms 6388 KB Output is correct
4 Correct 6 ms 6476 KB Output is correct
5 Correct 4 ms 6228 KB Output is correct
6 Correct 4 ms 6228 KB Output is correct
7 Correct 5 ms 6484 KB Output is correct
8 Correct 6 ms 6484 KB Output is correct
9 Correct 6 ms 6484 KB Output is correct
10 Correct 6 ms 6484 KB Output is correct
11 Correct 6 ms 6484 KB Output is correct
12 Correct 5 ms 6484 KB Output is correct
13 Correct 5 ms 6344 KB Output is correct
14 Correct 5 ms 6352 KB Output is correct
15 Correct 6 ms 6356 KB Output is correct
16 Correct 6 ms 6424 KB Output is correct
17 Correct 5 ms 6356 KB Output is correct
18 Correct 6 ms 6484 KB Output is correct
19 Correct 5 ms 6484 KB Output is correct
20 Correct 6 ms 6484 KB Output is correct
21 Correct 6 ms 6484 KB Output is correct
22 Correct 6 ms 6484 KB Output is correct
23 Correct 6 ms 6484 KB Output is correct
24 Correct 6 ms 6484 KB Output is correct
25 Correct 5 ms 6216 KB Output is correct
26 Correct 4 ms 6216 KB Output is correct
27 Correct 6 ms 6624 KB Output is correct
28 Correct 6 ms 6484 KB Output is correct
29 Correct 7 ms 6488 KB Output is correct
30 Correct 6 ms 6484 KB Output is correct
31 Correct 6 ms 6476 KB Output is correct
32 Correct 6 ms 6492 KB Output is correct
33 Correct 5 ms 6344 KB Output is correct
34 Correct 6 ms 6356 KB Output is correct
35 Correct 6 ms 6476 KB Output is correct
36 Correct 6 ms 6448 KB Output is correct
37 Correct 7 ms 6372 KB Output is correct
38 Correct 7 ms 6484 KB Output is correct
39 Correct 64 ms 14328 KB Output is correct
40 Correct 82 ms 15004 KB Output is correct
41 Correct 85 ms 15000 KB Output is correct
42 Correct 68 ms 14924 KB Output is correct
43 Correct 77 ms 15028 KB Output is correct
44 Correct 71 ms 15028 KB Output is correct
45 Correct 24 ms 9000 KB Output is correct
46 Correct 22 ms 9072 KB Output is correct
47 Correct 68 ms 15248 KB Output is correct
48 Correct 73 ms 15004 KB Output is correct
49 Correct 74 ms 15180 KB Output is correct
50 Correct 71 ms 15520 KB Output is correct
51 Correct 62 ms 14128 KB Output is correct
52 Correct 79 ms 15848 KB Output is correct
53 Correct 72 ms 14520 KB Output is correct
54 Correct 75 ms 15772 KB Output is correct
55 Correct 425 ms 38208 KB Output is correct
56 Correct 329 ms 35788 KB Output is correct
57 Correct 465 ms 42640 KB Output is correct
58 Correct 397 ms 38832 KB Output is correct
59 Correct 394 ms 34952 KB Output is correct
60 Correct 529 ms 42180 KB Output is correct
61 Correct 97 ms 16500 KB Output is correct
62 Correct 92 ms 16432 KB Output is correct
63 Correct 483 ms 43500 KB Output is correct
64 Correct 490 ms 43468 KB Output is correct
65 Correct 471 ms 42236 KB Output is correct
66 Correct 454 ms 42272 KB Output is correct
67 Correct 457 ms 42200 KB Output is correct
68 Correct 490 ms 42156 KB Output is correct
69 Correct 467 ms 42128 KB Output is correct
70 Correct 482 ms 41688 KB Output is correct
71 Correct 461 ms 41180 KB Output is correct
72 Correct 467 ms 41208 KB Output is correct
73 Correct 511 ms 41164 KB Output is correct
74 Correct 475 ms 41108 KB Output is correct
75 Correct 465 ms 41124 KB Output is correct
76 Correct 479 ms 41136 KB Output is correct
77 Correct 471 ms 41272 KB Output is correct
78 Correct 479 ms 41116 KB Output is correct
79 Correct 342 ms 30416 KB Output is correct
80 Correct 350 ms 32068 KB Output is correct
81 Correct 377 ms 40736 KB Output is correct
82 Correct 87 ms 15412 KB Output is correct
83 Correct 77 ms 15036 KB Output is correct
84 Correct 19 ms 8812 KB Output is correct
85 Correct 22 ms 9048 KB Output is correct
86 Correct 85 ms 16032 KB Output is correct
87 Correct 96 ms 16064 KB Output is correct
88 Correct 101 ms 16020 KB Output is correct
89 Correct 89 ms 16044 KB Output is correct
90 Correct 101 ms 16080 KB Output is correct
91 Correct 103 ms 15996 KB Output is correct
92 Correct 62 ms 13552 KB Output is correct
93 Correct 77 ms 13632 KB Output is correct
94 Correct 65 ms 13704 KB Output is correct
95 Correct 80 ms 15408 KB Output is correct
96 Correct 99 ms 15956 KB Output is correct
97 Correct 95 ms 16004 KB Output is correct
98 Correct 67 ms 14628 KB Output is correct
99 Correct 78 ms 15784 KB Output is correct
100 Correct 85 ms 14960 KB Output is correct
101 Correct 92 ms 15240 KB Output is correct
102 Correct 106 ms 15932 KB Output is correct
103 Correct 69 ms 14900 KB Output is correct
104 Correct 89 ms 15436 KB Output is correct
105 Correct 103 ms 16036 KB Output is correct
106 Correct 27 ms 9176 KB Output is correct
107 Correct 25 ms 8752 KB Output is correct
108 Correct 64 ms 13184 KB Output is correct
109 Correct 61 ms 12224 KB Output is correct
110 Correct 84 ms 13252 KB Output is correct
111 Correct 86 ms 13216 KB Output is correct
112 Correct 87 ms 15424 KB Output is correct
113 Correct 96 ms 16628 KB Output is correct
114 Correct 102 ms 15872 KB Output is correct
115 Correct 114 ms 16716 KB Output is correct
116 Correct 69 ms 14404 KB Output is correct
117 Correct 91 ms 16600 KB Output is correct
118 Correct 76 ms 14468 KB Output is correct
119 Correct 76 ms 14284 KB Output is correct
120 Correct 115 ms 16588 KB Output is correct
121 Correct 99 ms 16564 KB Output is correct
122 Correct 92 ms 16116 KB Output is correct
123 Correct 101 ms 16640 KB Output is correct
124 Correct 98 ms 16612 KB Output is correct
125 Correct 87 ms 14736 KB Output is correct
126 Correct 60 ms 14152 KB Output is correct
127 Correct 69 ms 13292 KB Output is correct
128 Correct 88 ms 14208 KB Output is correct
129 Correct 80 ms 16452 KB Output is correct
130 Correct 462 ms 43052 KB Output is correct
131 Correct 326 ms 36568 KB Output is correct
132 Correct 452 ms 43404 KB Output is correct
133 Correct 461 ms 42016 KB Output is correct
134 Correct 470 ms 41164 KB Output is correct
135 Correct 506 ms 42896 KB Output is correct
136 Correct 489 ms 44412 KB Output is correct
137 Correct 482 ms 44420 KB Output is correct
138 Correct 517 ms 42812 KB Output is correct
139 Correct 517 ms 42828 KB Output is correct
140 Correct 427 ms 42876 KB Output is correct
141 Correct 494 ms 43120 KB Output is correct
142 Correct 518 ms 42940 KB Output is correct
143 Correct 503 ms 42848 KB Output is correct
144 Correct 444 ms 42944 KB Output is correct
145 Correct 502 ms 42892 KB Output is correct
146 Correct 483 ms 42912 KB Output is correct
147 Correct 489 ms 42936 KB Output is correct
148 Correct 503 ms 43080 KB Output is correct
149 Correct 480 ms 42832 KB Output is correct
150 Correct 241 ms 33776 KB Output is correct
151 Correct 344 ms 33856 KB Output is correct
152 Correct 370 ms 33964 KB Output is correct
153 Correct 349 ms 42328 KB Output is correct