답안 #1065531

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1065531 2024-08-19T08:59:58 Z 정민찬(#11118) 푸드 코트 (JOI21_foodcourt) C++17
100 / 100
442 ms 59032 KB
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pll;

struct SegmentTree{
    vector<ll> tree;
    void init(ll n) {
        ll sz = 1 << __lg(n-1) + 2;
        tree.assign(sz, 0);
    }
    void update(ll node, ll s, ll e, ll tar, ll val) {
        if (s > tar || tar > e) return;
        tree[node] += val;
        if (s == e) {
            return;
        }
        ll mid = s + e >> 1;
        update(node*2, s, mid, tar, val);
        update(node*2+1, mid+1, e, tar, val);
        tree[node] = tree[node*2] + tree[node*2+1];
    }
    ll query(ll node, ll s, ll e, ll l, ll r) {
        if (l > e || s > r) return 0;
        if (l <= s && e <= r) return tree[node];
        ll mid = s + e >> 1;
        return query(node*2, s, mid, l, r) + query(node*2+1, mid+1, e, l, r);
    }
    pll findLeft(ll node, ll s, ll e, ll l, ll r, ll k) {
        if (l > e || s > r) return {-1, 0};
        if (l <= s && e <= r && tree[node] < k) return {-1, tree[node]};
        if (s == e) return {s, 0};
        ll mid = s + e >> 1;
        pll t = findLeft(node*2, s, mid, l, r, k);
        if (t.first == -1) {
            pll t2 = findLeft(node*2+1, mid+1, e, l, r, k - t.second);
            return {t2.first, t.second + t2.second};
        }
        return t;
    }
};

struct Node{
    ll sum, mnl, mnidx;
};

Node Merge(Node u, Node v) {
    Node ret;
    ret.sum = u.sum + v.sum;
    if (u.mnl <= u.sum + v.mnl) {
        ret.mnl = u.mnl;
        ret.mnidx = u.mnidx;
    }
    else {
        ret.mnl = u.sum + v.mnl;
        ret.mnidx = v.mnidx;
    }
    return ret;
}

struct SegmentTree2{
    vector<Node> tree;
    void init(ll n) {
        ll sz = 1 << __lg(n-1) + 2;
        tree.resize(sz);
        build(1, 1, n);
    }
    void build(ll node, ll s, ll e) {
        if (s == e) {
            tree[node] = {0, 0, s-1};
            return;
        }
        ll mid = s + e >> 1;
        build(node*2, s, mid);
        build(node*2+1, mid+1, e);
        tree[node] = Merge(tree[node*2], tree[node*2+1]);
    }
    void update(ll node, ll s, ll e, ll tar, ll val) {
        if (s > tar || tar > e) return;
        if (s == e) {
            if (val < 0) tree[node] = {val, val, s};
            else tree[node] = {val, 0, s-1};
            return;
        }
        ll mid = s + e >> 1;
        update(node*2, s, mid, tar, val);
        update(node*2+1, mid+1, e, tar, val);
        tree[node] = Merge(tree[node*2], tree[node*2+1]);
    }
    Node query(ll node, ll s, ll e, ll l, ll r) {
        if (l <= s && e <= r) return tree[node];
        ll mid = s + e >> 1;
        if (r <= mid) return query(node*2, s, mid, l, r);
        if (l >= mid+1) return query(node*2+1, mid+1, e, l, r);
        return Merge(query(node*2, s, mid, l, r), query(node*2+1, mid+1, e, l, r));
    }
};

vector<array<ll,3>> upd[250010];
vector<pll> qry[250010];

SegmentTree pseg, mseg;
SegmentTree2 seg2;

int main() {
    ios_base :: sync_with_stdio(false); cin.tie(NULL);
    ll N, M, Q;
    cin >> N >> M >> Q;
    vector<ll> num(Q + 1, -1);
    for (ll i=1; i<=Q; i++) {
        ll t;
        cin >> t;
        if (t == 1) {
            ll l, r, c, k;
            cin >> l >> r >> c >> k;
            upd[l].push_back({i, k, c});
            upd[r+1].push_back({i, -k, c});
            num[i] = c;
        }
        else if (t == 2) {
            ll l, r, k;
            cin >> l >> r >> k;
            upd[l].push_back({i, k, 0});
            upd[r+1].push_back({i, -k, 0});
        }
        else {
            ll a, b;
            cin >> a >> b;
            qry[a].push_back({i, b});
        }
    }
    pseg.init(Q);
    mseg.init(Q);
    seg2.init(Q);
    vector<ll> ans(Q+1, -1);
    for (ll i=1; i<=N; i++) {
        for (auto &[j, k, c] : upd[i]) {
            if (c != 0) {
                pseg.update(1, 1, Q, j, k);
                if (k < 0) seg2.update(1, 1, Q, j, 0);
                else seg2.update(1, 1, Q, j, k);
            }
            else {
                mseg.update(1, 1, Q, j, k);
                if (k < 0) seg2.update(1, 1, Q, j, 0);
                else seg2.update(1, 1, Q, j, -k);
            }
        }
        for (auto &[j, cnt] : qry[i]) {
            Node ret = seg2.query(1, 1, Q, 1, j);
            assert(ret.mnidx < j);
            ll mret = mseg.query(1, 1, Q, ret.mnidx + 1, j);
            if (pseg.query(1, 1, Q, ret.mnidx+1, j) < mret + cnt) {
                ans[j] = 0;
                continue;
            }
            ll pret = pseg.findLeft(1, 1, Q, ret.mnidx+1, j, mret + cnt).first;
            assert(pret != -1);
            ans[j] = num[pret];
        }
    }
    for (ll i=1; i<=Q; i++) {
        if (ans[i] != -1) {
            cout << ans[i] << '\n';
        }
    }
}

Compilation message

foodcourt.cpp: In member function 'void SegmentTree::init(ll)':
foodcourt.cpp:11:32: warning: suggest parentheses around '+' inside '<<' [-Wparentheses]
   11 |         ll sz = 1 << __lg(n-1) + 2;
      |                      ~~~~~~~~~~^~~
foodcourt.cpp: In member function 'void SegmentTree::update(ll, ll, ll, ll, ll)':
foodcourt.cpp:20:20: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   20 |         ll mid = s + e >> 1;
      |                  ~~^~~
foodcourt.cpp: In member function 'll SegmentTree::query(ll, ll, ll, ll, ll)':
foodcourt.cpp:28:20: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   28 |         ll mid = s + e >> 1;
      |                  ~~^~~
foodcourt.cpp: In member function 'pll SegmentTree::findLeft(ll, ll, ll, ll, ll, ll)':
foodcourt.cpp:35:20: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   35 |         ll mid = s + e >> 1;
      |                  ~~^~~
foodcourt.cpp: In member function 'void SegmentTree2::init(ll)':
foodcourt.cpp:66:32: warning: suggest parentheses around '+' inside '<<' [-Wparentheses]
   66 |         ll sz = 1 << __lg(n-1) + 2;
      |                      ~~~~~~~~~~^~~
foodcourt.cpp: In member function 'void SegmentTree2::build(ll, ll, ll)':
foodcourt.cpp:75:20: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   75 |         ll mid = s + e >> 1;
      |                  ~~^~~
foodcourt.cpp: In member function 'void SegmentTree2::update(ll, ll, ll, ll, ll)':
foodcourt.cpp:87:20: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   87 |         ll mid = s + e >> 1;
      |                  ~~^~~
foodcourt.cpp: In member function 'Node SegmentTree2::query(ll, ll, ll, ll, ll)':
foodcourt.cpp:94:20: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   94 |         ll mid = s + e >> 1;
      |                  ~~^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 12376 KB Output is correct
2 Correct 4 ms 12376 KB Output is correct
3 Correct 4 ms 12376 KB Output is correct
4 Correct 4 ms 12380 KB Output is correct
5 Correct 3 ms 12380 KB Output is correct
6 Correct 3 ms 12380 KB Output is correct
7 Correct 5 ms 12376 KB Output is correct
8 Correct 6 ms 12376 KB Output is correct
9 Correct 4 ms 12380 KB Output is correct
10 Correct 4 ms 12500 KB Output is correct
11 Correct 4 ms 12380 KB Output is correct
12 Correct 5 ms 12380 KB Output is correct
13 Correct 4 ms 12380 KB Output is correct
14 Correct 4 ms 12468 KB Output is correct
15 Correct 3 ms 12380 KB Output is correct
16 Correct 4 ms 12380 KB Output is correct
17 Correct 3 ms 12380 KB Output is correct
18 Correct 4 ms 12380 KB Output is correct
19 Correct 4 ms 12380 KB Output is correct
20 Correct 4 ms 12340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 12376 KB Output is correct
2 Correct 4 ms 12376 KB Output is correct
3 Correct 4 ms 12376 KB Output is correct
4 Correct 4 ms 12380 KB Output is correct
5 Correct 3 ms 12380 KB Output is correct
6 Correct 3 ms 12380 KB Output is correct
7 Correct 5 ms 12376 KB Output is correct
8 Correct 6 ms 12376 KB Output is correct
9 Correct 4 ms 12380 KB Output is correct
10 Correct 4 ms 12500 KB Output is correct
11 Correct 4 ms 12380 KB Output is correct
12 Correct 5 ms 12380 KB Output is correct
13 Correct 4 ms 12380 KB Output is correct
14 Correct 4 ms 12468 KB Output is correct
15 Correct 3 ms 12380 KB Output is correct
16 Correct 4 ms 12380 KB Output is correct
17 Correct 3 ms 12380 KB Output is correct
18 Correct 4 ms 12380 KB Output is correct
19 Correct 4 ms 12380 KB Output is correct
20 Correct 4 ms 12340 KB Output is correct
21 Correct 4 ms 12376 KB Output is correct
22 Correct 4 ms 12380 KB Output is correct
23 Correct 3 ms 12380 KB Output is correct
24 Correct 4 ms 12508 KB Output is correct
25 Correct 3 ms 12380 KB Output is correct
26 Correct 4 ms 12468 KB Output is correct
27 Correct 5 ms 12380 KB Output is correct
28 Correct 5 ms 12380 KB Output is correct
29 Correct 4 ms 12464 KB Output is correct
30 Correct 5 ms 12380 KB Output is correct
31 Correct 4 ms 12380 KB Output is correct
32 Correct 6 ms 12380 KB Output is correct
33 Correct 3 ms 12376 KB Output is correct
34 Correct 4 ms 12380 KB Output is correct
35 Correct 4 ms 12380 KB Output is correct
36 Correct 4 ms 12380 KB Output is correct
37 Correct 4 ms 12380 KB Output is correct
38 Correct 4 ms 12380 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 59 ms 21584 KB Output is correct
2 Correct 64 ms 21896 KB Output is correct
3 Correct 65 ms 21844 KB Output is correct
4 Correct 55 ms 21584 KB Output is correct
5 Correct 60 ms 21844 KB Output is correct
6 Correct 60 ms 21848 KB Output is correct
7 Correct 31 ms 20344 KB Output is correct
8 Correct 32 ms 20848 KB Output is correct
9 Correct 78 ms 22004 KB Output is correct
10 Correct 62 ms 22016 KB Output is correct
11 Correct 70 ms 22024 KB Output is correct
12 Correct 63 ms 21840 KB Output is correct
13 Correct 76 ms 21396 KB Output is correct
14 Correct 63 ms 21852 KB Output is correct
15 Correct 63 ms 22092 KB Output is correct
16 Correct 68 ms 22148 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 372 ms 48464 KB Output is correct
2 Correct 300 ms 49580 KB Output is correct
3 Correct 407 ms 55748 KB Output is correct
4 Correct 289 ms 50068 KB Output is correct
5 Correct 277 ms 50472 KB Output is correct
6 Correct 442 ms 57032 KB Output is correct
7 Correct 150 ms 51512 KB Output is correct
8 Correct 148 ms 51284 KB Output is correct
9 Correct 367 ms 54460 KB Output is correct
10 Correct 336 ms 54540 KB Output is correct
11 Correct 354 ms 56916 KB Output is correct
12 Correct 343 ms 56916 KB Output is correct
13 Correct 357 ms 56848 KB Output is correct
14 Correct 322 ms 56916 KB Output is correct
15 Correct 389 ms 56728 KB Output is correct
16 Correct 390 ms 56656 KB Output is correct
17 Correct 394 ms 56732 KB Output is correct
18 Correct 408 ms 56824 KB Output is correct
19 Correct 384 ms 56848 KB Output is correct
20 Correct 417 ms 56692 KB Output is correct
21 Correct 378 ms 56752 KB Output is correct
22 Correct 402 ms 56696 KB Output is correct
23 Correct 352 ms 56748 KB Output is correct
24 Correct 354 ms 56660 KB Output is correct
25 Correct 271 ms 57940 KB Output is correct
26 Correct 287 ms 58364 KB Output is correct
27 Correct 277 ms 57552 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 12376 KB Output is correct
2 Correct 4 ms 12376 KB Output is correct
3 Correct 4 ms 12376 KB Output is correct
4 Correct 4 ms 12380 KB Output is correct
5 Correct 3 ms 12380 KB Output is correct
6 Correct 3 ms 12380 KB Output is correct
7 Correct 5 ms 12376 KB Output is correct
8 Correct 6 ms 12376 KB Output is correct
9 Correct 4 ms 12380 KB Output is correct
10 Correct 4 ms 12500 KB Output is correct
11 Correct 4 ms 12380 KB Output is correct
12 Correct 5 ms 12380 KB Output is correct
13 Correct 4 ms 12380 KB Output is correct
14 Correct 4 ms 12468 KB Output is correct
15 Correct 3 ms 12380 KB Output is correct
16 Correct 4 ms 12380 KB Output is correct
17 Correct 3 ms 12380 KB Output is correct
18 Correct 4 ms 12380 KB Output is correct
19 Correct 4 ms 12380 KB Output is correct
20 Correct 4 ms 12340 KB Output is correct
21 Correct 59 ms 21584 KB Output is correct
22 Correct 64 ms 21896 KB Output is correct
23 Correct 65 ms 21844 KB Output is correct
24 Correct 55 ms 21584 KB Output is correct
25 Correct 60 ms 21844 KB Output is correct
26 Correct 60 ms 21848 KB Output is correct
27 Correct 31 ms 20344 KB Output is correct
28 Correct 32 ms 20848 KB Output is correct
29 Correct 78 ms 22004 KB Output is correct
30 Correct 62 ms 22016 KB Output is correct
31 Correct 70 ms 22024 KB Output is correct
32 Correct 63 ms 21840 KB Output is correct
33 Correct 76 ms 21396 KB Output is correct
34 Correct 63 ms 21852 KB Output is correct
35 Correct 63 ms 22092 KB Output is correct
36 Correct 68 ms 22148 KB Output is correct
37 Correct 57 ms 21344 KB Output is correct
38 Correct 65 ms 21076 KB Output is correct
39 Correct 28 ms 20340 KB Output is correct
40 Correct 37 ms 20696 KB Output is correct
41 Correct 65 ms 21844 KB Output is correct
42 Correct 63 ms 22100 KB Output is correct
43 Correct 64 ms 21980 KB Output is correct
44 Correct 77 ms 21940 KB Output is correct
45 Correct 63 ms 22004 KB Output is correct
46 Correct 64 ms 22016 KB Output is correct
47 Correct 39 ms 21120 KB Output is correct
48 Correct 58 ms 22528 KB Output is correct
49 Correct 54 ms 20568 KB Output is correct
50 Correct 59 ms 21380 KB Output is correct
51 Correct 68 ms 22104 KB Output is correct
52 Correct 62 ms 22108 KB Output is correct
53 Correct 47 ms 21084 KB Output is correct
54 Correct 57 ms 22100 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 53 ms 21076 KB Output is correct
2 Correct 64 ms 21332 KB Output is correct
3 Correct 65 ms 21336 KB Output is correct
4 Correct 44 ms 20048 KB Output is correct
5 Correct 53 ms 20828 KB Output is correct
6 Correct 61 ms 21380 KB Output is correct
7 Correct 32 ms 20272 KB Output is correct
8 Correct 29 ms 20080 KB Output is correct
9 Correct 49 ms 20828 KB Output is correct
10 Correct 40 ms 20568 KB Output is correct
11 Correct 57 ms 21340 KB Output is correct
12 Correct 60 ms 21340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 12376 KB Output is correct
2 Correct 4 ms 12376 KB Output is correct
3 Correct 4 ms 12376 KB Output is correct
4 Correct 4 ms 12380 KB Output is correct
5 Correct 3 ms 12380 KB Output is correct
6 Correct 3 ms 12380 KB Output is correct
7 Correct 5 ms 12376 KB Output is correct
8 Correct 6 ms 12376 KB Output is correct
9 Correct 4 ms 12380 KB Output is correct
10 Correct 4 ms 12500 KB Output is correct
11 Correct 4 ms 12380 KB Output is correct
12 Correct 5 ms 12380 KB Output is correct
13 Correct 4 ms 12380 KB Output is correct
14 Correct 4 ms 12468 KB Output is correct
15 Correct 3 ms 12380 KB Output is correct
16 Correct 4 ms 12380 KB Output is correct
17 Correct 3 ms 12380 KB Output is correct
18 Correct 4 ms 12380 KB Output is correct
19 Correct 4 ms 12380 KB Output is correct
20 Correct 4 ms 12340 KB Output is correct
21 Correct 4 ms 12376 KB Output is correct
22 Correct 4 ms 12380 KB Output is correct
23 Correct 3 ms 12380 KB Output is correct
24 Correct 4 ms 12508 KB Output is correct
25 Correct 3 ms 12380 KB Output is correct
26 Correct 4 ms 12468 KB Output is correct
27 Correct 5 ms 12380 KB Output is correct
28 Correct 5 ms 12380 KB Output is correct
29 Correct 4 ms 12464 KB Output is correct
30 Correct 5 ms 12380 KB Output is correct
31 Correct 4 ms 12380 KB Output is correct
32 Correct 6 ms 12380 KB Output is correct
33 Correct 3 ms 12376 KB Output is correct
34 Correct 4 ms 12380 KB Output is correct
35 Correct 4 ms 12380 KB Output is correct
36 Correct 4 ms 12380 KB Output is correct
37 Correct 4 ms 12380 KB Output is correct
38 Correct 4 ms 12380 KB Output is correct
39 Correct 59 ms 21584 KB Output is correct
40 Correct 64 ms 21896 KB Output is correct
41 Correct 65 ms 21844 KB Output is correct
42 Correct 55 ms 21584 KB Output is correct
43 Correct 60 ms 21844 KB Output is correct
44 Correct 60 ms 21848 KB Output is correct
45 Correct 31 ms 20344 KB Output is correct
46 Correct 32 ms 20848 KB Output is correct
47 Correct 78 ms 22004 KB Output is correct
48 Correct 62 ms 22016 KB Output is correct
49 Correct 70 ms 22024 KB Output is correct
50 Correct 63 ms 21840 KB Output is correct
51 Correct 76 ms 21396 KB Output is correct
52 Correct 63 ms 21852 KB Output is correct
53 Correct 63 ms 22092 KB Output is correct
54 Correct 68 ms 22148 KB Output is correct
55 Correct 57 ms 21344 KB Output is correct
56 Correct 65 ms 21076 KB Output is correct
57 Correct 28 ms 20340 KB Output is correct
58 Correct 37 ms 20696 KB Output is correct
59 Correct 65 ms 21844 KB Output is correct
60 Correct 63 ms 22100 KB Output is correct
61 Correct 64 ms 21980 KB Output is correct
62 Correct 77 ms 21940 KB Output is correct
63 Correct 63 ms 22004 KB Output is correct
64 Correct 64 ms 22016 KB Output is correct
65 Correct 39 ms 21120 KB Output is correct
66 Correct 58 ms 22528 KB Output is correct
67 Correct 54 ms 20568 KB Output is correct
68 Correct 59 ms 21380 KB Output is correct
69 Correct 68 ms 22104 KB Output is correct
70 Correct 62 ms 22108 KB Output is correct
71 Correct 47 ms 21084 KB Output is correct
72 Correct 57 ms 22100 KB Output is correct
73 Correct 53 ms 21076 KB Output is correct
74 Correct 64 ms 21332 KB Output is correct
75 Correct 65 ms 21336 KB Output is correct
76 Correct 44 ms 20048 KB Output is correct
77 Correct 53 ms 20828 KB Output is correct
78 Correct 61 ms 21380 KB Output is correct
79 Correct 32 ms 20272 KB Output is correct
80 Correct 29 ms 20080 KB Output is correct
81 Correct 49 ms 20828 KB Output is correct
82 Correct 40 ms 20568 KB Output is correct
83 Correct 57 ms 21340 KB Output is correct
84 Correct 60 ms 21340 KB Output is correct
85 Correct 66 ms 21336 KB Output is correct
86 Correct 77 ms 21792 KB Output is correct
87 Correct 59 ms 21340 KB Output is correct
88 Correct 64 ms 22096 KB Output is correct
89 Correct 40 ms 20312 KB Output is correct
90 Correct 62 ms 22100 KB Output is correct
91 Correct 58 ms 21228 KB Output is correct
92 Correct 55 ms 20824 KB Output is correct
93 Correct 70 ms 22100 KB Output is correct
94 Correct 67 ms 22008 KB Output is correct
95 Correct 65 ms 21936 KB Output is correct
96 Correct 74 ms 22100 KB Output is correct
97 Correct 76 ms 22096 KB Output is correct
98 Correct 57 ms 21328 KB Output is correct
99 Correct 45 ms 20928 KB Output is correct
100 Correct 50 ms 21328 KB Output is correct
101 Correct 63 ms 22608 KB Output is correct
102 Correct 65 ms 22352 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 12376 KB Output is correct
2 Correct 4 ms 12376 KB Output is correct
3 Correct 4 ms 12376 KB Output is correct
4 Correct 4 ms 12380 KB Output is correct
5 Correct 3 ms 12380 KB Output is correct
6 Correct 3 ms 12380 KB Output is correct
7 Correct 5 ms 12376 KB Output is correct
8 Correct 6 ms 12376 KB Output is correct
9 Correct 4 ms 12380 KB Output is correct
10 Correct 4 ms 12500 KB Output is correct
11 Correct 4 ms 12380 KB Output is correct
12 Correct 5 ms 12380 KB Output is correct
13 Correct 4 ms 12380 KB Output is correct
14 Correct 4 ms 12468 KB Output is correct
15 Correct 3 ms 12380 KB Output is correct
16 Correct 4 ms 12380 KB Output is correct
17 Correct 3 ms 12380 KB Output is correct
18 Correct 4 ms 12380 KB Output is correct
19 Correct 4 ms 12380 KB Output is correct
20 Correct 4 ms 12340 KB Output is correct
21 Correct 4 ms 12376 KB Output is correct
22 Correct 4 ms 12380 KB Output is correct
23 Correct 3 ms 12380 KB Output is correct
24 Correct 4 ms 12508 KB Output is correct
25 Correct 3 ms 12380 KB Output is correct
26 Correct 4 ms 12468 KB Output is correct
27 Correct 5 ms 12380 KB Output is correct
28 Correct 5 ms 12380 KB Output is correct
29 Correct 4 ms 12464 KB Output is correct
30 Correct 5 ms 12380 KB Output is correct
31 Correct 4 ms 12380 KB Output is correct
32 Correct 6 ms 12380 KB Output is correct
33 Correct 3 ms 12376 KB Output is correct
34 Correct 4 ms 12380 KB Output is correct
35 Correct 4 ms 12380 KB Output is correct
36 Correct 4 ms 12380 KB Output is correct
37 Correct 4 ms 12380 KB Output is correct
38 Correct 4 ms 12380 KB Output is correct
39 Correct 59 ms 21584 KB Output is correct
40 Correct 64 ms 21896 KB Output is correct
41 Correct 65 ms 21844 KB Output is correct
42 Correct 55 ms 21584 KB Output is correct
43 Correct 60 ms 21844 KB Output is correct
44 Correct 60 ms 21848 KB Output is correct
45 Correct 31 ms 20344 KB Output is correct
46 Correct 32 ms 20848 KB Output is correct
47 Correct 78 ms 22004 KB Output is correct
48 Correct 62 ms 22016 KB Output is correct
49 Correct 70 ms 22024 KB Output is correct
50 Correct 63 ms 21840 KB Output is correct
51 Correct 76 ms 21396 KB Output is correct
52 Correct 63 ms 21852 KB Output is correct
53 Correct 63 ms 22092 KB Output is correct
54 Correct 68 ms 22148 KB Output is correct
55 Correct 372 ms 48464 KB Output is correct
56 Correct 300 ms 49580 KB Output is correct
57 Correct 407 ms 55748 KB Output is correct
58 Correct 289 ms 50068 KB Output is correct
59 Correct 277 ms 50472 KB Output is correct
60 Correct 442 ms 57032 KB Output is correct
61 Correct 150 ms 51512 KB Output is correct
62 Correct 148 ms 51284 KB Output is correct
63 Correct 367 ms 54460 KB Output is correct
64 Correct 336 ms 54540 KB Output is correct
65 Correct 354 ms 56916 KB Output is correct
66 Correct 343 ms 56916 KB Output is correct
67 Correct 357 ms 56848 KB Output is correct
68 Correct 322 ms 56916 KB Output is correct
69 Correct 389 ms 56728 KB Output is correct
70 Correct 390 ms 56656 KB Output is correct
71 Correct 394 ms 56732 KB Output is correct
72 Correct 408 ms 56824 KB Output is correct
73 Correct 384 ms 56848 KB Output is correct
74 Correct 417 ms 56692 KB Output is correct
75 Correct 378 ms 56752 KB Output is correct
76 Correct 402 ms 56696 KB Output is correct
77 Correct 352 ms 56748 KB Output is correct
78 Correct 354 ms 56660 KB Output is correct
79 Correct 271 ms 57940 KB Output is correct
80 Correct 287 ms 58364 KB Output is correct
81 Correct 277 ms 57552 KB Output is correct
82 Correct 57 ms 21344 KB Output is correct
83 Correct 65 ms 21076 KB Output is correct
84 Correct 28 ms 20340 KB Output is correct
85 Correct 37 ms 20696 KB Output is correct
86 Correct 65 ms 21844 KB Output is correct
87 Correct 63 ms 22100 KB Output is correct
88 Correct 64 ms 21980 KB Output is correct
89 Correct 77 ms 21940 KB Output is correct
90 Correct 63 ms 22004 KB Output is correct
91 Correct 64 ms 22016 KB Output is correct
92 Correct 39 ms 21120 KB Output is correct
93 Correct 58 ms 22528 KB Output is correct
94 Correct 54 ms 20568 KB Output is correct
95 Correct 59 ms 21380 KB Output is correct
96 Correct 68 ms 22104 KB Output is correct
97 Correct 62 ms 22108 KB Output is correct
98 Correct 47 ms 21084 KB Output is correct
99 Correct 57 ms 22100 KB Output is correct
100 Correct 53 ms 21076 KB Output is correct
101 Correct 64 ms 21332 KB Output is correct
102 Correct 65 ms 21336 KB Output is correct
103 Correct 44 ms 20048 KB Output is correct
104 Correct 53 ms 20828 KB Output is correct
105 Correct 61 ms 21380 KB Output is correct
106 Correct 32 ms 20272 KB Output is correct
107 Correct 29 ms 20080 KB Output is correct
108 Correct 49 ms 20828 KB Output is correct
109 Correct 40 ms 20568 KB Output is correct
110 Correct 57 ms 21340 KB Output is correct
111 Correct 60 ms 21340 KB Output is correct
112 Correct 66 ms 21336 KB Output is correct
113 Correct 77 ms 21792 KB Output is correct
114 Correct 59 ms 21340 KB Output is correct
115 Correct 64 ms 22096 KB Output is correct
116 Correct 40 ms 20312 KB Output is correct
117 Correct 62 ms 22100 KB Output is correct
118 Correct 58 ms 21228 KB Output is correct
119 Correct 55 ms 20824 KB Output is correct
120 Correct 70 ms 22100 KB Output is correct
121 Correct 67 ms 22008 KB Output is correct
122 Correct 65 ms 21936 KB Output is correct
123 Correct 74 ms 22100 KB Output is correct
124 Correct 76 ms 22096 KB Output is correct
125 Correct 57 ms 21328 KB Output is correct
126 Correct 45 ms 20928 KB Output is correct
127 Correct 50 ms 21328 KB Output is correct
128 Correct 63 ms 22608 KB Output is correct
129 Correct 65 ms 22352 KB Output is correct
130 Correct 392 ms 56400 KB Output is correct
131 Correct 252 ms 49976 KB Output is correct
132 Correct 332 ms 56340 KB Output is correct
133 Correct 301 ms 56408 KB Output is correct
134 Correct 275 ms 53760 KB Output is correct
135 Correct 330 ms 57680 KB Output is correct
136 Correct 339 ms 55592 KB Output is correct
137 Correct 313 ms 55476 KB Output is correct
138 Correct 330 ms 57424 KB Output is correct
139 Correct 325 ms 57388 KB Output is correct
140 Correct 362 ms 57316 KB Output is correct
141 Correct 352 ms 57424 KB Output is correct
142 Correct 350 ms 57452 KB Output is correct
143 Correct 414 ms 57424 KB Output is correct
144 Correct 344 ms 57308 KB Output is correct
145 Correct 342 ms 57428 KB Output is correct
146 Correct 359 ms 57476 KB Output is correct
147 Correct 370 ms 57428 KB Output is correct
148 Correct 392 ms 57428 KB Output is correct
149 Correct 353 ms 57636 KB Output is correct
150 Correct 192 ms 52896 KB Output is correct
151 Correct 299 ms 58980 KB Output is correct
152 Correct 355 ms 59032 KB Output is correct
153 Correct 287 ms 58408 KB Output is correct