Submission #943831

# Submission time Handle Problem Language Result Execution time Memory
943831 2024-03-12T01:57:01 Z Pannda Fish 2 (JOI22_fish2) C++17
100 / 100
2291 ms 16856 KB
#include <bits/stdc++.h>
using namespace std;

struct Paint {
    struct Node {
        int mn, cnt;
        int lazy = 0;
        void add(int delta) {
            mn += delta;
            lazy += delta;
        }
        void merge(Node a, Node b) {
            mn = min(a.mn, b.mn);
            cnt = 0;
            if (a.mn == mn) cnt += a.cnt;
            if (b.mn == mn) cnt += b.cnt;
        }
    };

    int n;
    vector<Node> nodes;

    Paint(int n) : n(n), nodes(4 * n) {
        auto dfs = [&](auto self, int idx, int l, int r) -> void {
            if (l + 1 == r) {
                nodes[idx].mn = 0;
                nodes[idx].cnt = 1;
            } else {
                int m = (l + r) >> 1;
                self(self, 2 * idx + 1, l, m);
                self(self, 2 * idx + 2, m, r);
                nodes[idx].merge(nodes[2 * idx + 1], nodes[2 * idx + 2]);
            }
        };
        dfs(dfs, 0, 0, n);
    }

    void down(int idx) {
        nodes[2 * idx + 1].add(nodes[idx].lazy);
        nodes[2 * idx + 2].add(nodes[idx].lazy);
        nodes[idx].lazy = 0;
    }

    void add(int ql, int qr, int delta) {
        auto dfs = [&](auto self, int idx, int l, int r) -> void {
            if (r <= ql || qr <= l) return;
            if (ql <= l && r <= qr) return nodes[idx].add(delta);
            down(idx);
            int m = (l + r) >> 1;
            self(self, 2 * idx + 1, l, m);
            self(self, 2 * idx + 2, m, r);
            nodes[idx].merge(nodes[2 * idx + 1], nodes[2 * idx + 2]);
        };
        dfs(dfs, 0, 0, n);
    }

    int countMin(int ql, int qr) {
        int fetch = 0;
        int mn = 1e9;
        auto findMin = [&](auto self, int idx, int l, int r) -> void {
            if (r <= ql || qr <= l) return;
            if (ql <= l && r <= qr) {
                mn = min(mn, nodes[idx].mn);
                return;
            }
            down(idx);
            int m = (l + r) >> 1;
            self(self, 2 * idx + 1, l, m);
            self(self, 2 * idx + 2, m, r);
        };
        auto dfs = [&](auto self, int idx, int l, int r) -> void {
            if (r <= ql || qr <= l) return;
            if (ql <= l && r <= qr) {
                fetch += (nodes[idx].mn == mn) * nodes[idx].cnt;
                return;
            }
            down(idx);
            int m = (l + r) >> 1;
            self(self, 2 * idx + 1, l, m);
            self(self, 2 * idx + 2, m, r);
        };
        findMin(findMin, 0, 0, n);
        dfs(dfs, 0, 0, n);
        return fetch;
    }
};

struct SegmentWalk {
    int n;
    vector<int> mx;

    SegmentWalk(int n) : n(n), mx(4 * n, 0) {}

    void set(int i, int val) {
        auto dfs = [&](auto self, int idx, int l, int r) -> void {
            if (l + 1 == r) {
                mx[idx] = val;
            } else {
                int m = (l + r) >> 1;
                if (i < m) self(self, 2 * idx + 1, l, m);
                else self(self, 2 * idx + 2, m, r);
                mx[idx] = max(mx[2 * idx + 1], mx[2 * idx + 2]);
            }
        };
        dfs(dfs, 0, 0, n);
    }

    int walk(int ql, int qr, long long bound, bool request_leftmost) { // in [ql, qr), returns the leftmost (rightmost) position with value > 'bound'
        auto dfs = [&](auto self, int idx, int l, int r) -> int {
            if (r <= ql || qr <= l || mx[idx] <= bound) return -1;
            if (ql <= l && r <= qr) {
                while (l + 1 < r) {
                    int m = (l + r) >> 1;
                    if (request_leftmost) {
                        if (mx[2 * idx + 1] > bound) idx = 2 * idx + 1, r = m;
                        else idx = 2 * idx + 2, l = m;
                    } else {
                        if (mx[2 * idx + 2] > bound) idx = 2 * idx + 2, l = m;
                        else idx = 2 * idx + 1, r = m;
                    }
                }
                return l;
            }
            int m = (l + r) >> 1;
            if (request_leftmost) {
                int get = self(self, 2 * idx + 1, l, m);
                if (get != -1) return get;
                return self(self, 2 * idx + 2, m, r);
            } else {
                int get = self(self, 2 * idx + 2, m, r);
                if (get != -1) return get;
                return self(self, 2 * idx + 1, l, m);
            }
        };
        return dfs(dfs, 0, 0, n);
    }
};

struct Fenwick {
    int n;
    vector<long long> bit;

    Fenwick(int n) : n(n), bit(n + 1, 0) {}

    void add(int i, int delta) {
        for (i++; i <= n; i += i & -i) bit[i] += delta;
    }

    long long sum(int i) {
        long long res = 0;
        for (; i > 0; i -= i & -i) res += bit[i];
        return res;
    }

    long long sum(int l, int r) {
        return sum(r) - sum(l);
    }
};

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
//    freopen("inp.inp", "r", stdin);
//    freopen("out.out", "w", stdout);

    int n;
    cin >> n;

    vector<int> a(n);
    Fenwick fen(n);
    SegmentWalk segwalk(n);

    for (int i = 0; i < n; i++) {
        cin >> a[i];
        fen.add(i, a[i]);
        segwalk.set(i, a[i]);
    }

    auto findSaturatedInterval = [&](int ql, int qr, int &l, int &r, long long &sum) -> void { // O(log^2), find the tightest saturated interval (or [l, r)) containing the initial interval [l, r)
        while (ql < l || r < qr) {
            long long old_sum = sum;
            if (ql < l) {
                int p = segwalk.walk(ql, l, sum, false);
                if (p == -1) {
                    sum += fen.sum(ql, l);
                    l = ql;
                } else {
                    sum += fen.sum(p + 1, l);
                    l = p + 1;
                    if (sum >= a[p]) {
                        sum += a[p];
                        l = p;
                    }
                }
            }
            if (r < qr) {
                int p = segwalk.walk(r, qr, sum, true);
                if (p == -1) {
                    sum += fen.sum(r, qr);
                    r = qr;
                } else {
                    sum += fen.sum(r, p);
                    r = p;
                    if (sum >= a[p]) {
                        sum += a[p];
                        r = p + 1;
                    }
                }
            }
            if (sum == old_sum) break;
        }
    };

    auto findAllSaturatedIntervals = [&](int ql, int qr, int i) -> vector<array<int, 2>> { // O(log^2), find all saturated intervals containing i
        vector<array<int, 2>> res;
        int l = i, r = i + 1;
        long long sum = a[i];
        while (true) {
            findSaturatedInterval(ql, qr, l, r, sum);
            if (l == ql && r == qr) break;
            res.push_back({l, r});
            if (l == ql || (r < qr && a[r] <= a[l - 1])) {
                sum += a[r];
                r = r + 1;
            } else {
                sum += a[l - 1];
                l = l - 1;
            }
        }
        return res;
    };

    Paint paint(n);
    SegmentWalk wow(n);
    vector<vector<int>> why(n);

    auto erase = [&](int ql, int qr) -> vector<array<int, 2>> { // erases all intervals containing [ql, qr), return the set of deleted intervals
        vector<array<int, 2>> res;
        if (ql < 0 || qr > n) return res;
        while (true) {
            int l = wow.walk(0, ql + 1, qr - 1, true);
            if (l == -1) break;
            int r = why[l].back();
            res.push_back({l, r});
            paint.add(l, r, -1);
            why[l].pop_back();
            if (why[l].empty()) wow.set(l, 0);
            else wow.set(l, why[l].back());
        }
        return res;
    };

    auto insert = [&](int l, int r) -> void {
        if (find(why[l].begin(), why[l].end(), r) != why[l].end()) return;
        auto it = why[l].begin();
        while (it != why[l].end() && *it < r) ++it;
        why[l].insert(it, r);
        wow.set(l, why[l].back());
        paint.add(l, r, +1);
    };

    for (int i = 0; i < n; i++) {
        int l = i, r = i + 1;
        long long sum = a[i];
        findSaturatedInterval(0, n, l, r, sum);
        if (l != 0 || r != n) insert(l, r);
    }

    int q;
    cin >> q;
    while (q--) {
        int type;
        cin >> type;
        if (type == 1) {
            int i, x;
            cin >> i >> x;
            i--;
            auto subinsert = [&](int i) -> void {
                if (i < 0 || i >= n) return;
                for (auto [l, r] : findAllSaturatedIntervals(0, n, i)) insert(l, r);
            };
            erase(i - 1, i);
            erase(i, i + 1);
            erase(i + 1, i + 2);
            fen.add(i, -a[i] + x);
            a[i] = x;
            segwalk.set(i, x);
            subinsert(i - 1);
            subinsert(i);
            subinsert(i + 1);
        }
        if (type == 2) {
            int l, r;
            cin >> l >> r;
            l--;
            vector<array<int, 2>> insert0 = findAllSaturatedIntervals(l, r, l);
            vector<array<int, 2>> insert1 = findAllSaturatedIntervals(l, r, r - 1);
            for (auto [l, r] : insert0) paint.add(l, r, +1);
            for (auto [l, r] : insert1) paint.add(l, r, +1);
            cout << paint.countMin(l, r) << '\n';
            for (auto [l, r] : insert0) paint.add(l, r, -1);
            for (auto [l, r] : insert1) paint.add(l, r, -1);
        }
    }
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 6 ms 524 KB Output is correct
6 Correct 4 ms 520 KB Output is correct
7 Correct 5 ms 348 KB Output is correct
8 Correct 5 ms 348 KB Output is correct
9 Correct 4 ms 348 KB Output is correct
10 Correct 2 ms 348 KB Output is correct
11 Correct 2 ms 460 KB Output is correct
12 Correct 3 ms 532 KB Output is correct
13 Correct 3 ms 348 KB Output is correct
14 Correct 3 ms 348 KB Output is correct
15 Correct 3 ms 344 KB Output is correct
16 Correct 2 ms 344 KB Output is correct
17 Correct 3 ms 348 KB Output is correct
18 Correct 3 ms 604 KB Output is correct
19 Correct 2 ms 348 KB Output is correct
20 Correct 2 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 103 ms 12784 KB Output is correct
3 Correct 105 ms 12804 KB Output is correct
4 Correct 102 ms 12628 KB Output is correct
5 Correct 103 ms 12532 KB Output is correct
6 Correct 68 ms 13904 KB Output is correct
7 Correct 112 ms 12624 KB Output is correct
8 Correct 69 ms 13880 KB Output is correct
9 Correct 110 ms 12620 KB Output is correct
10 Correct 94 ms 13596 KB Output is correct
11 Correct 91 ms 13116 KB Output is correct
12 Correct 86 ms 13268 KB Output is correct
13 Correct 84 ms 13136 KB Output is correct
14 Correct 88 ms 13824 KB Output is correct
15 Correct 86 ms 13680 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 6 ms 524 KB Output is correct
6 Correct 4 ms 520 KB Output is correct
7 Correct 5 ms 348 KB Output is correct
8 Correct 5 ms 348 KB Output is correct
9 Correct 4 ms 348 KB Output is correct
10 Correct 2 ms 348 KB Output is correct
11 Correct 2 ms 460 KB Output is correct
12 Correct 3 ms 532 KB Output is correct
13 Correct 3 ms 348 KB Output is correct
14 Correct 3 ms 348 KB Output is correct
15 Correct 3 ms 344 KB Output is correct
16 Correct 2 ms 344 KB Output is correct
17 Correct 3 ms 348 KB Output is correct
18 Correct 3 ms 604 KB Output is correct
19 Correct 2 ms 348 KB Output is correct
20 Correct 2 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 103 ms 12784 KB Output is correct
23 Correct 105 ms 12804 KB Output is correct
24 Correct 102 ms 12628 KB Output is correct
25 Correct 103 ms 12532 KB Output is correct
26 Correct 68 ms 13904 KB Output is correct
27 Correct 112 ms 12624 KB Output is correct
28 Correct 69 ms 13880 KB Output is correct
29 Correct 110 ms 12620 KB Output is correct
30 Correct 94 ms 13596 KB Output is correct
31 Correct 91 ms 13116 KB Output is correct
32 Correct 86 ms 13268 KB Output is correct
33 Correct 84 ms 13136 KB Output is correct
34 Correct 88 ms 13824 KB Output is correct
35 Correct 86 ms 13680 KB Output is correct
36 Correct 125 ms 13144 KB Output is correct
37 Correct 118 ms 12808 KB Output is correct
38 Correct 118 ms 12624 KB Output is correct
39 Correct 127 ms 12904 KB Output is correct
40 Correct 111 ms 12632 KB Output is correct
41 Correct 71 ms 13904 KB Output is correct
42 Correct 73 ms 13944 KB Output is correct
43 Correct 123 ms 12536 KB Output is correct
44 Correct 119 ms 12624 KB Output is correct
45 Correct 113 ms 13648 KB Output is correct
46 Correct 103 ms 13648 KB Output is correct
47 Correct 102 ms 12472 KB Output is correct
48 Correct 91 ms 13112 KB Output is correct
49 Correct 90 ms 13136 KB Output is correct
50 Correct 90 ms 13904 KB Output is correct
51 Correct 90 ms 13648 KB Output is correct
52 Correct 86 ms 14060 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 103 ms 12784 KB Output is correct
3 Correct 105 ms 12804 KB Output is correct
4 Correct 102 ms 12628 KB Output is correct
5 Correct 103 ms 12532 KB Output is correct
6 Correct 68 ms 13904 KB Output is correct
7 Correct 112 ms 12624 KB Output is correct
8 Correct 69 ms 13880 KB Output is correct
9 Correct 110 ms 12620 KB Output is correct
10 Correct 94 ms 13596 KB Output is correct
11 Correct 91 ms 13116 KB Output is correct
12 Correct 86 ms 13268 KB Output is correct
13 Correct 84 ms 13136 KB Output is correct
14 Correct 88 ms 13824 KB Output is correct
15 Correct 86 ms 13680 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 1464 ms 14644 KB Output is correct
18 Correct 1298 ms 14700 KB Output is correct
19 Correct 1497 ms 14504 KB Output is correct
20 Correct 1611 ms 14708 KB Output is correct
21 Correct 1387 ms 14440 KB Output is correct
22 Correct 1274 ms 14688 KB Output is correct
23 Correct 1263 ms 14428 KB Output is correct
24 Correct 1755 ms 14416 KB Output is correct
25 Correct 1371 ms 14544 KB Output is correct
26 Correct 1702 ms 14712 KB Output is correct
27 Correct 357 ms 15728 KB Output is correct
28 Correct 343 ms 15864 KB Output is correct
29 Correct 345 ms 15668 KB Output is correct
30 Correct 1280 ms 14348 KB Output is correct
31 Correct 1200 ms 14160 KB Output is correct
32 Correct 2279 ms 15440 KB Output is correct
33 Correct 781 ms 15608 KB Output is correct
34 Correct 2291 ms 14720 KB Output is correct
35 Correct 1331 ms 14544 KB Output is correct
36 Correct 1604 ms 15476 KB Output is correct
37 Correct 559 ms 14620 KB Output is correct
38 Correct 542 ms 15188 KB Output is correct
39 Correct 474 ms 15852 KB Output is correct
40 Correct 472 ms 15608 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 103 ms 12784 KB Output is correct
3 Correct 105 ms 12804 KB Output is correct
4 Correct 102 ms 12628 KB Output is correct
5 Correct 103 ms 12532 KB Output is correct
6 Correct 68 ms 13904 KB Output is correct
7 Correct 112 ms 12624 KB Output is correct
8 Correct 69 ms 13880 KB Output is correct
9 Correct 110 ms 12620 KB Output is correct
10 Correct 94 ms 13596 KB Output is correct
11 Correct 91 ms 13116 KB Output is correct
12 Correct 86 ms 13268 KB Output is correct
13 Correct 84 ms 13136 KB Output is correct
14 Correct 88 ms 13824 KB Output is correct
15 Correct 86 ms 13680 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 1812 ms 14320 KB Output is correct
18 Correct 967 ms 16508 KB Output is correct
19 Correct 1735 ms 14024 KB Output is correct
20 Correct 873 ms 15856 KB Output is correct
21 Correct 1804 ms 14340 KB Output is correct
22 Correct 951 ms 16276 KB Output is correct
23 Correct 1620 ms 13928 KB Output is correct
24 Correct 926 ms 16060 KB Output is correct
25 Correct 1503 ms 14208 KB Output is correct
26 Correct 421 ms 16116 KB Output is correct
27 Correct 467 ms 16204 KB Output is correct
28 Correct 718 ms 15432 KB Output is correct
29 Correct 404 ms 16272 KB Output is correct
30 Correct 475 ms 16256 KB Output is correct
31 Correct 799 ms 15548 KB Output is correct
32 Correct 911 ms 16144 KB Output is correct
33 Correct 698 ms 14460 KB Output is correct
34 Correct 829 ms 16688 KB Output is correct
35 Correct 733 ms 14888 KB Output is correct
36 Correct 780 ms 15880 KB Output is correct
37 Correct 812 ms 15152 KB Output is correct
38 Correct 660 ms 14972 KB Output is correct
39 Correct 501 ms 16076 KB Output is correct
40 Correct 376 ms 15692 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 6 ms 524 KB Output is correct
6 Correct 4 ms 520 KB Output is correct
7 Correct 5 ms 348 KB Output is correct
8 Correct 5 ms 348 KB Output is correct
9 Correct 4 ms 348 KB Output is correct
10 Correct 2 ms 348 KB Output is correct
11 Correct 2 ms 460 KB Output is correct
12 Correct 3 ms 532 KB Output is correct
13 Correct 3 ms 348 KB Output is correct
14 Correct 3 ms 348 KB Output is correct
15 Correct 3 ms 344 KB Output is correct
16 Correct 2 ms 344 KB Output is correct
17 Correct 3 ms 348 KB Output is correct
18 Correct 3 ms 604 KB Output is correct
19 Correct 2 ms 348 KB Output is correct
20 Correct 2 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 103 ms 12784 KB Output is correct
23 Correct 105 ms 12804 KB Output is correct
24 Correct 102 ms 12628 KB Output is correct
25 Correct 103 ms 12532 KB Output is correct
26 Correct 68 ms 13904 KB Output is correct
27 Correct 112 ms 12624 KB Output is correct
28 Correct 69 ms 13880 KB Output is correct
29 Correct 110 ms 12620 KB Output is correct
30 Correct 94 ms 13596 KB Output is correct
31 Correct 91 ms 13116 KB Output is correct
32 Correct 86 ms 13268 KB Output is correct
33 Correct 84 ms 13136 KB Output is correct
34 Correct 88 ms 13824 KB Output is correct
35 Correct 86 ms 13680 KB Output is correct
36 Correct 125 ms 13144 KB Output is correct
37 Correct 118 ms 12808 KB Output is correct
38 Correct 118 ms 12624 KB Output is correct
39 Correct 127 ms 12904 KB Output is correct
40 Correct 111 ms 12632 KB Output is correct
41 Correct 71 ms 13904 KB Output is correct
42 Correct 73 ms 13944 KB Output is correct
43 Correct 123 ms 12536 KB Output is correct
44 Correct 119 ms 12624 KB Output is correct
45 Correct 113 ms 13648 KB Output is correct
46 Correct 103 ms 13648 KB Output is correct
47 Correct 102 ms 12472 KB Output is correct
48 Correct 91 ms 13112 KB Output is correct
49 Correct 90 ms 13136 KB Output is correct
50 Correct 90 ms 13904 KB Output is correct
51 Correct 90 ms 13648 KB Output is correct
52 Correct 86 ms 14060 KB Output is correct
53 Correct 0 ms 348 KB Output is correct
54 Correct 1464 ms 14644 KB Output is correct
55 Correct 1298 ms 14700 KB Output is correct
56 Correct 1497 ms 14504 KB Output is correct
57 Correct 1611 ms 14708 KB Output is correct
58 Correct 1387 ms 14440 KB Output is correct
59 Correct 1274 ms 14688 KB Output is correct
60 Correct 1263 ms 14428 KB Output is correct
61 Correct 1755 ms 14416 KB Output is correct
62 Correct 1371 ms 14544 KB Output is correct
63 Correct 1702 ms 14712 KB Output is correct
64 Correct 357 ms 15728 KB Output is correct
65 Correct 343 ms 15864 KB Output is correct
66 Correct 345 ms 15668 KB Output is correct
67 Correct 1280 ms 14348 KB Output is correct
68 Correct 1200 ms 14160 KB Output is correct
69 Correct 2279 ms 15440 KB Output is correct
70 Correct 781 ms 15608 KB Output is correct
71 Correct 2291 ms 14720 KB Output is correct
72 Correct 1331 ms 14544 KB Output is correct
73 Correct 1604 ms 15476 KB Output is correct
74 Correct 559 ms 14620 KB Output is correct
75 Correct 542 ms 15188 KB Output is correct
76 Correct 474 ms 15852 KB Output is correct
77 Correct 472 ms 15608 KB Output is correct
78 Correct 0 ms 348 KB Output is correct
79 Correct 1812 ms 14320 KB Output is correct
80 Correct 967 ms 16508 KB Output is correct
81 Correct 1735 ms 14024 KB Output is correct
82 Correct 873 ms 15856 KB Output is correct
83 Correct 1804 ms 14340 KB Output is correct
84 Correct 951 ms 16276 KB Output is correct
85 Correct 1620 ms 13928 KB Output is correct
86 Correct 926 ms 16060 KB Output is correct
87 Correct 1503 ms 14208 KB Output is correct
88 Correct 421 ms 16116 KB Output is correct
89 Correct 467 ms 16204 KB Output is correct
90 Correct 718 ms 15432 KB Output is correct
91 Correct 404 ms 16272 KB Output is correct
92 Correct 475 ms 16256 KB Output is correct
93 Correct 799 ms 15548 KB Output is correct
94 Correct 911 ms 16144 KB Output is correct
95 Correct 698 ms 14460 KB Output is correct
96 Correct 829 ms 16688 KB Output is correct
97 Correct 733 ms 14888 KB Output is correct
98 Correct 780 ms 15880 KB Output is correct
99 Correct 812 ms 15152 KB Output is correct
100 Correct 660 ms 14972 KB Output is correct
101 Correct 501 ms 16076 KB Output is correct
102 Correct 376 ms 15692 KB Output is correct
103 Correct 1772 ms 13716 KB Output is correct
104 Correct 926 ms 16856 KB Output is correct
105 Correct 1539 ms 14524 KB Output is correct
106 Correct 1094 ms 15256 KB Output is correct
107 Correct 1661 ms 14280 KB Output is correct
108 Correct 982 ms 16452 KB Output is correct
109 Correct 1424 ms 14692 KB Output is correct
110 Correct 1031 ms 15616 KB Output is correct
111 Correct 1493 ms 14724 KB Output is correct
112 Correct 1109 ms 15444 KB Output is correct
113 Correct 438 ms 16224 KB Output is correct
114 Correct 344 ms 16032 KB Output is correct
115 Correct 858 ms 15684 KB Output is correct
116 Correct 841 ms 15380 KB Output is correct
117 Correct 369 ms 16176 KB Output is correct
118 Correct 885 ms 15184 KB Output is correct
119 Correct 468 ms 16444 KB Output is correct
120 Correct 852 ms 15664 KB Output is correct
121 Correct 830 ms 15112 KB Output is correct
122 Correct 949 ms 16140 KB Output is correct
123 Correct 860 ms 14464 KB Output is correct
124 Correct 991 ms 15156 KB Output is correct
125 Correct 1215 ms 14572 KB Output is correct
126 Correct 1140 ms 14960 KB Output is correct
127 Correct 884 ms 15264 KB Output is correct
128 Correct 726 ms 15184 KB Output is correct
129 Correct 606 ms 16472 KB Output is correct
130 Correct 497 ms 15848 KB Output is correct