Submission #1060940

# Submission time Handle Problem Language Result Execution time Memory
1060940 2024-08-16T04:50:02 Z becaido Radio Towers (IOI22_towers) C++17
100 / 100
1095 ms 75608 KB
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx,popcnt,sse4,abm")
#include <bits/stdc++.h>
using namespace std;

#ifndef WAIMAI
#include "towers.h"
#else
#include "stub.cpp"
#endif

#ifdef WAIMAI
#define debug(HEHE...) cout << "[" << #HEHE << "] : ", dout(HEHE)
void dout() {cout << '\n';}
template<typename T, typename...U>
void dout(T t, U...u) {cout << t << (sizeof...(u) ? ", " : ""), dout(u...);}
#else
#define debug(...) 7122
#endif

#define ll long long
#define Waimai ios::sync_with_stdio(false), cin.tie(0)
#define FOR(x,a,b) for (int x = a, I = b; x <= I; x++)
#define pb emplace_back
#define F first
#define S second

#define lpos pos*2
#define rpos pos*2+1

const int INF = 2e9 + 1;
const int SIZE = 1e5 + 5;

int n;
int a[SIZE], ty[SIZE];

struct Segtree {
    struct T {
        int mx, mn, ld, rd;
        T operator + (const T &o) const {
            T re;
            re.mx = max(mx, o.mx);
            re.mn = min(mn, o.mn);
            re.ld = max({ld, o.ld, o.mx - mn});
            re.rd = max({rd, o.rd, mx - o.mn});
            return re;
        }
    } node[SIZE << 2];

    void build(int pos, int l, int r) {
        if (l == r) {
            node[pos].mx = node[pos].mn = a[l];
            return;
        }
        int mid = (l + r) / 2;
        build(lpos, l, mid);
        build(rpos, mid + 1, r);
        node[pos] = node[lpos] + node[rpos];
    }
    int schl(int pos, int l, int r, int L, int R, int x) {
        if (l == L && r == R) {
            if (node[pos].mx < x) return 0;
            if (l == r) return l;
            int mid = (L + R) / 2, re = schl(lpos, l, mid, L, mid, x);
            return re == 0 ? schl(rpos, mid + 1, r, mid + 1, R, x) : re;
        }
        int mid = (L + R) / 2, re;
        if (r <= mid) return schl(lpos, l, r, L, mid, x);
        if (l > mid) return schl(rpos, l, r, mid + 1, R, x);
        re = schl(lpos, l, mid, L, mid, x);
        return re == 0 ? schl(rpos, mid + 1, r, mid + 1, R, x) : re;
    }
    int schr(int pos, int l, int r, int L, int R, int x) {
        if (l == L && r == R) {
            if (node[pos].mx < x) return 0;
            if (l == r) return l;
            int mid = (L + R) / 2, re = schr(rpos, mid + 1, r, mid + 1, R, x);
            return re == 0 ? schr(lpos, l, mid, L, mid, x) : re;
        }
        int mid = (L + R) / 2, re;
        if (r <= mid) return schr(lpos, l, r, L, mid, x);
        if (l > mid) return schr(rpos, l, r, mid + 1, R, x);
        re = schr(rpos, mid + 1, r, mid + 1, R, x);
        return re == 0 ? schr(lpos, l, mid, L, mid, x) : re;
    }
    T que(int pos, int l, int r, int L, int R) {
        if (l == L && r == R) return node[pos];
        int mid = (L + R) / 2;
        if (r <= mid) return que(lpos, l, r, L, mid);
        if (l > mid) return que(rpos, l, r, mid + 1, R);
        return que(lpos, l, mid, L, mid) + que(rpos, mid + 1, r, mid + 1, R);
    }
} tree;

struct Node {
    int cnt, pcnt, ls, rs;
} node[2 * SIZE * (__lg(SIZE) + 3)];

int sz, root;
vector<pair<int, int>> vroot;
void upd(int &pos, int l, int r, int p, int t, int x) {
    node[++sz] = node[pos];
    pos = sz;
    (t == 1 ? node[pos].cnt : node[pos].pcnt) += x;
    if (l == r) return;
    int mid = (l + r) / 2;
    if (p <= mid) upd(node[pos].ls, l, mid, p, t, x);
    else upd(node[pos].rs, mid + 1, r, p, t, x);
}
int que(int pos, int l, int r, int L, int R, int t) {
    if (l == L && r == R) return t == 1 ? node[pos].cnt : node[pos].pcnt;
    int mid = (L + R) / 2;
    if (r <= mid) return que(node[pos].ls, l, r, L, mid, t);
    if (l > mid) return que(node[pos].rs, l, r, mid + 1, R, t);
    return que(node[pos].ls, l, mid, L, mid, t) + que(node[pos].rs, mid + 1, r, mid + 1, R, t);
}
int sch(int pos, int l, int r, int t, int k) {
    int tot = (t == 1 ? node[pos].cnt : node[pos].pcnt);
    if (k > tot) return 0;
    if (l == r) return l;
    int mid = (l + r) / 2, ltot = (t == 1 ? node[node[pos].ls].cnt : node[node[pos].ls].pcnt);
    return k <= ltot ? sch(node[pos].ls, l, mid, t, k) : sch(node[pos].rs, mid + 1, r, t, k - ltot);
}

void init(int N, vector<int> H) {
    n = N;
    if (n == 1) return;
    FOR (i, 1, n) a[i] = H[i - 1];
    FOR (i, 1, n) {
        if ((i == 1 || a[i] < a[i - 1]) && (i == n || a[i] < a[i + 1])) ty[i] = 1;
        if ((i == 1 || a[i] > a[i - 1]) && (i == n || a[i] > a[i + 1])) ty[i] = 2;
    }
    set<int> s;
    multiset<pair<int, int>> ms;
    for (int i = 1, x = 1; i <= n; i++) if (ty[i] == x) {
        s.insert(i);
        x ^= 3;
    }
    if (ty[*s.rbegin()] == 2) s.erase(*s.rbegin());
    a[0] = a[n + 1] = INF;
    s.insert(0), s.insert(n + 1);
    bool f = 0;
    for (auto it = s.begin(); it != s.end(); it++) {
        f ^= 1;
        if (f == 0) continue;
        int i = *it;
        if (it != s.begin()) {
            int l = *prev(it);
            ms.emplace(a[i] - a[l], i);
        }
        if (next(it) != s.end()) {
            int r = *next(it);
            ms.emplace(a[i] - a[r], i);
        }
    }
    for (int i : s) if (ty[i]) upd(root, 1, n, i, ty[i], 1);
    vroot.pb(0, root);
    while (s.size() > 3) {
        int d = ms.begin()->F;
        while (ms.size() && ms.begin()->F == d) {
            auto [_, i] = *ms.begin();
            auto it = s.lower_bound(i), lit = prev(it), rit = next(it);
            int l = *lit, r = *rit;
            int il = *prev(lit), ir = *next(rit);
            if (a[l] > a[r]) {
                ms.erase(ms.find({a[i] - a[l], i}));
                ms.erase(ms.find({a[il] - a[l], il}));
                if (a[i] < a[il]) {
                    ms.erase({a[i] - a[r], i});
                    ms.emplace(a[il] - a[r], il);
                    s.erase(i), upd(root, 1, n, i, 2, -1);
                } else {
                    int j = *prev(s.find(il));
                    ms.erase(ms.find({a[il] - a[j], il}));
                    ms.emplace(a[i] - a[j], i);
                    s.erase(il), upd(root, 1, n, il, 2, -1);
                }
                s.erase(l), upd(root, 1, n, l, 1, -1);
            } else {
                ms.erase(ms.find({a[i] - a[r], i}));
                ms.erase(ms.find({a[ir] - a[r], ir}));
                if (a[i] < a[ir]) {
                    ms.erase({a[i] - a[l], i});
                    ms.emplace(a[ir] - a[l], ir);
                    s.erase(i), upd(root, 1, n, i, 2, -1);
                } else {
                    int j = *next(s.find(ir));
                    ms.erase(ms.find({a[ir] - a[j], ir}));
                    ms.emplace(a[i] - a[j], i);
                    s.erase(ir), upd(root, 1, n, ir, 2, -1);
                }
                s.erase(r), upd(root, 1, n, r, 1, -1);
            }
        }
        vroot.pb(d + 1, root);
    }
    tree.build(1, 1, n);
}

int max_towers(int L, int R, int D) {
    L++, R++;
    if (L == R) return 1;
    root = (lower_bound(vroot.begin(), vroot.end(), make_pair(D + 1, 0)) - 1)->S;
    int ans = que(root, L, R, 1, n, 1);
    if (ans == 0) {
        int pcnt = que(root, L, R, 1, n, 2);
        if (pcnt == 0) return 1;
        int i = sch(root, 1, n, 2, L == 1 ? 1 : que(root, 1, L - 1, 1, n, 2) + 1);
        return 1 + (tree.que(1, L, i, 1, n).mn + D <= a[i] && tree.que(1, i, R, 1, n).mn + D <= a[i]);
    }
    {
        int i = sch(root, 1, n, 1, L == 1 ? 1 : que(root, 1, L - 1, 1, n, 1) + 1);
        int j = tree.schr(1, L, i, 1, n, a[i] + D);
        if (j) ans += (tree.que(1, L, j, 1, n).ld >= D);
    }
    {
        int i = sch(root, 1, n, 1, que(root, 1, R, 1, n, 1));
        int j = tree.schl(1, i, R, 1, n, a[i] + D);
        if (j) ans += (tree.que(1, j, R, 1, n).rd >= D);
    }
    return ans;
}

/*
in1
7 3
10 20 60 40 50 30 70
1 5 10
2 2 100
0 6 17
out1
3
1
2
*/
# Verdict Execution time Memory Grader output
1 Correct 344 ms 7256 KB Output is correct
2 Correct 724 ms 9816 KB Output is correct
3 Correct 693 ms 9816 KB Output is correct
4 Correct 668 ms 9816 KB Output is correct
5 Correct 729 ms 9816 KB Output is correct
6 Correct 685 ms 9816 KB Output is correct
7 Correct 667 ms 9816 KB Output is correct
8 Correct 1 ms 4440 KB Output is correct
9 Correct 1 ms 4440 KB Output is correct
10 Correct 1 ms 4440 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 4440 KB Output is correct
2 Correct 3 ms 6744 KB Output is correct
3 Correct 3 ms 6744 KB Output is correct
4 Correct 3 ms 6888 KB Output is correct
5 Correct 2 ms 6744 KB Output is correct
6 Correct 3 ms 6744 KB Output is correct
7 Correct 3 ms 6744 KB Output is correct
8 Correct 1 ms 4652 KB Output is correct
9 Correct 1 ms 4440 KB Output is correct
10 Correct 1 ms 4440 KB Output is correct
11 Correct 1 ms 4440 KB Output is correct
12 Correct 1 ms 4440 KB Output is correct
13 Correct 1 ms 4440 KB Output is correct
14 Correct 1 ms 4440 KB Output is correct
15 Correct 2 ms 6744 KB Output is correct
16 Correct 3 ms 6744 KB Output is correct
17 Correct 2 ms 6744 KB Output is correct
18 Correct 1 ms 4440 KB Output is correct
19 Correct 1 ms 4440 KB Output is correct
20 Correct 2 ms 6744 KB Output is correct
21 Correct 2 ms 6744 KB Output is correct
22 Correct 3 ms 6744 KB Output is correct
23 Correct 1 ms 4440 KB Output is correct
24 Correct 1 ms 4440 KB Output is correct
25 Correct 1 ms 6744 KB Output is correct
26 Correct 2 ms 6744 KB Output is correct
27 Correct 2 ms 6744 KB Output is correct
28 Correct 3 ms 6744 KB Output is correct
29 Correct 3 ms 6744 KB Output is correct
30 Correct 3 ms 6744 KB Output is correct
31 Correct 2 ms 6744 KB Output is correct
32 Correct 1 ms 4440 KB Output is correct
33 Correct 1 ms 4440 KB Output is correct
34 Correct 1 ms 4440 KB Output is correct
35 Correct 1 ms 4440 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 4440 KB Output is correct
2 Correct 3 ms 6744 KB Output is correct
3 Correct 3 ms 6744 KB Output is correct
4 Correct 3 ms 6888 KB Output is correct
5 Correct 2 ms 6744 KB Output is correct
6 Correct 3 ms 6744 KB Output is correct
7 Correct 3 ms 6744 KB Output is correct
8 Correct 1 ms 4652 KB Output is correct
9 Correct 1 ms 4440 KB Output is correct
10 Correct 1 ms 4440 KB Output is correct
11 Correct 1 ms 4440 KB Output is correct
12 Correct 1 ms 4440 KB Output is correct
13 Correct 1 ms 4440 KB Output is correct
14 Correct 1 ms 4440 KB Output is correct
15 Correct 2 ms 6744 KB Output is correct
16 Correct 3 ms 6744 KB Output is correct
17 Correct 2 ms 6744 KB Output is correct
18 Correct 1 ms 4440 KB Output is correct
19 Correct 1 ms 4440 KB Output is correct
20 Correct 2 ms 6744 KB Output is correct
21 Correct 2 ms 6744 KB Output is correct
22 Correct 3 ms 6744 KB Output is correct
23 Correct 1 ms 4440 KB Output is correct
24 Correct 1 ms 4440 KB Output is correct
25 Correct 1 ms 6744 KB Output is correct
26 Correct 2 ms 6744 KB Output is correct
27 Correct 2 ms 6744 KB Output is correct
28 Correct 3 ms 6744 KB Output is correct
29 Correct 3 ms 6744 KB Output is correct
30 Correct 3 ms 6744 KB Output is correct
31 Correct 2 ms 6744 KB Output is correct
32 Correct 1 ms 4440 KB Output is correct
33 Correct 1 ms 4440 KB Output is correct
34 Correct 1 ms 4440 KB Output is correct
35 Correct 1 ms 4440 KB Output is correct
36 Correct 71 ms 36572 KB Output is correct
37 Correct 113 ms 53712 KB Output is correct
38 Correct 106 ms 53704 KB Output is correct
39 Correct 176 ms 75464 KB Output is correct
40 Correct 185 ms 75464 KB Output is correct
41 Correct 182 ms 75464 KB Output is correct
42 Correct 163 ms 75464 KB Output is correct
43 Correct 10 ms 9816 KB Output is correct
44 Correct 10 ms 9800 KB Output is correct
45 Correct 10 ms 9816 KB Output is correct
46 Correct 11 ms 9812 KB Output is correct
47 Correct 103 ms 53704 KB Output is correct
48 Correct 161 ms 75468 KB Output is correct
49 Correct 166 ms 75464 KB Output is correct
50 Correct 10 ms 9816 KB Output is correct
51 Correct 10 ms 9836 KB Output is correct
52 Correct 105 ms 53708 KB Output is correct
53 Correct 195 ms 75464 KB Output is correct
54 Correct 170 ms 75464 KB Output is correct
55 Correct 10 ms 9816 KB Output is correct
56 Correct 10 ms 9816 KB Output is correct
57 Correct 96 ms 53456 KB Output is correct
58 Correct 98 ms 53704 KB Output is correct
59 Correct 104 ms 53716 KB Output is correct
60 Correct 179 ms 75464 KB Output is correct
61 Correct 163 ms 75464 KB Output is correct
62 Correct 165 ms 75384 KB Output is correct
63 Correct 166 ms 75412 KB Output is correct
64 Correct 13 ms 9816 KB Output is correct
65 Correct 10 ms 9644 KB Output is correct
66 Correct 10 ms 9816 KB Output is correct
67 Correct 10 ms 9800 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 675 ms 53400 KB Output is correct
2 Correct 939 ms 53660 KB Output is correct
3 Correct 912 ms 53448 KB Output is correct
4 Correct 932 ms 75464 KB Output is correct
5 Correct 1016 ms 75508 KB Output is correct
6 Correct 957 ms 75464 KB Output is correct
7 Correct 935 ms 75464 KB Output is correct
8 Correct 667 ms 9816 KB Output is correct
9 Correct 674 ms 9816 KB Output is correct
10 Correct 748 ms 9816 KB Output is correct
11 Correct 699 ms 9816 KB Output is correct
12 Correct 694 ms 9816 KB Output is correct
13 Correct 674 ms 9816 KB Output is correct
14 Correct 1 ms 4440 KB Output is correct
15 Correct 1 ms 4440 KB Output is correct
16 Correct 1 ms 4440 KB Output is correct
17 Correct 113 ms 53604 KB Output is correct
18 Correct 175 ms 75464 KB Output is correct
19 Correct 178 ms 75464 KB Output is correct
20 Correct 16 ms 10052 KB Output is correct
21 Correct 10 ms 9804 KB Output is correct
22 Correct 112 ms 53704 KB Output is correct
23 Correct 172 ms 75416 KB Output is correct
24 Correct 165 ms 75388 KB Output is correct
25 Correct 10 ms 9816 KB Output is correct
26 Correct 10 ms 9804 KB Output is correct
27 Correct 2 ms 6744 KB Output is correct
28 Correct 2 ms 6744 KB Output is correct
29 Correct 2 ms 6744 KB Output is correct
30 Correct 1 ms 4440 KB Output is correct
31 Correct 1 ms 4440 KB Output is correct
32 Correct 2 ms 6744 KB Output is correct
33 Correct 3 ms 6744 KB Output is correct
34 Correct 3 ms 6744 KB Output is correct
35 Correct 1 ms 4436 KB Output is correct
36 Correct 1 ms 4440 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 234 ms 16888 KB Output is correct
2 Correct 822 ms 53704 KB Output is correct
3 Correct 837 ms 53704 KB Output is correct
4 Correct 870 ms 75444 KB Output is correct
5 Correct 876 ms 75464 KB Output is correct
6 Correct 939 ms 75464 KB Output is correct
7 Correct 913 ms 75464 KB Output is correct
8 Correct 684 ms 9816 KB Output is correct
9 Correct 727 ms 9816 KB Output is correct
10 Correct 690 ms 9816 KB Output is correct
11 Correct 699 ms 9816 KB Output is correct
12 Correct 109 ms 53700 KB Output is correct
13 Correct 183 ms 75608 KB Output is correct
14 Correct 163 ms 75400 KB Output is correct
15 Correct 10 ms 9816 KB Output is correct
16 Correct 10 ms 9816 KB Output is correct
17 Correct 95 ms 53552 KB Output is correct
18 Correct 113 ms 53816 KB Output is correct
19 Correct 110 ms 53712 KB Output is correct
20 Correct 170 ms 75456 KB Output is correct
21 Correct 168 ms 75464 KB Output is correct
22 Correct 175 ms 75460 KB Output is correct
23 Correct 159 ms 75572 KB Output is correct
24 Correct 9 ms 9816 KB Output is correct
25 Correct 9 ms 9816 KB Output is correct
26 Correct 16 ms 9816 KB Output is correct
27 Correct 10 ms 9652 KB Output is correct
28 Correct 2 ms 6744 KB Output is correct
29 Correct 2 ms 6744 KB Output is correct
30 Correct 3 ms 6744 KB Output is correct
31 Correct 1 ms 4440 KB Output is correct
32 Correct 1 ms 4440 KB Output is correct
33 Correct 1 ms 6744 KB Output is correct
34 Correct 2 ms 6744 KB Output is correct
35 Correct 2 ms 6744 KB Output is correct
36 Correct 2 ms 6744 KB Output is correct
37 Correct 3 ms 6744 KB Output is correct
38 Correct 2 ms 6744 KB Output is correct
39 Correct 2 ms 6744 KB Output is correct
40 Correct 1 ms 4440 KB Output is correct
41 Correct 1 ms 4440 KB Output is correct
42 Correct 1 ms 4440 KB Output is correct
43 Correct 1 ms 4440 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 4440 KB Output is correct
2 Correct 3 ms 6744 KB Output is correct
3 Correct 3 ms 6744 KB Output is correct
4 Correct 3 ms 6888 KB Output is correct
5 Correct 2 ms 6744 KB Output is correct
6 Correct 3 ms 6744 KB Output is correct
7 Correct 3 ms 6744 KB Output is correct
8 Correct 1 ms 4652 KB Output is correct
9 Correct 1 ms 4440 KB Output is correct
10 Correct 1 ms 4440 KB Output is correct
11 Correct 1 ms 4440 KB Output is correct
12 Correct 1 ms 4440 KB Output is correct
13 Correct 1 ms 4440 KB Output is correct
14 Correct 1 ms 4440 KB Output is correct
15 Correct 2 ms 6744 KB Output is correct
16 Correct 3 ms 6744 KB Output is correct
17 Correct 2 ms 6744 KB Output is correct
18 Correct 1 ms 4440 KB Output is correct
19 Correct 1 ms 4440 KB Output is correct
20 Correct 2 ms 6744 KB Output is correct
21 Correct 2 ms 6744 KB Output is correct
22 Correct 3 ms 6744 KB Output is correct
23 Correct 1 ms 4440 KB Output is correct
24 Correct 1 ms 4440 KB Output is correct
25 Correct 1 ms 6744 KB Output is correct
26 Correct 2 ms 6744 KB Output is correct
27 Correct 2 ms 6744 KB Output is correct
28 Correct 3 ms 6744 KB Output is correct
29 Correct 3 ms 6744 KB Output is correct
30 Correct 3 ms 6744 KB Output is correct
31 Correct 2 ms 6744 KB Output is correct
32 Correct 1 ms 4440 KB Output is correct
33 Correct 1 ms 4440 KB Output is correct
34 Correct 1 ms 4440 KB Output is correct
35 Correct 1 ms 4440 KB Output is correct
36 Correct 71 ms 36572 KB Output is correct
37 Correct 113 ms 53712 KB Output is correct
38 Correct 106 ms 53704 KB Output is correct
39 Correct 176 ms 75464 KB Output is correct
40 Correct 185 ms 75464 KB Output is correct
41 Correct 182 ms 75464 KB Output is correct
42 Correct 163 ms 75464 KB Output is correct
43 Correct 10 ms 9816 KB Output is correct
44 Correct 10 ms 9800 KB Output is correct
45 Correct 10 ms 9816 KB Output is correct
46 Correct 11 ms 9812 KB Output is correct
47 Correct 103 ms 53704 KB Output is correct
48 Correct 161 ms 75468 KB Output is correct
49 Correct 166 ms 75464 KB Output is correct
50 Correct 10 ms 9816 KB Output is correct
51 Correct 10 ms 9836 KB Output is correct
52 Correct 105 ms 53708 KB Output is correct
53 Correct 195 ms 75464 KB Output is correct
54 Correct 170 ms 75464 KB Output is correct
55 Correct 10 ms 9816 KB Output is correct
56 Correct 10 ms 9816 KB Output is correct
57 Correct 96 ms 53456 KB Output is correct
58 Correct 98 ms 53704 KB Output is correct
59 Correct 104 ms 53716 KB Output is correct
60 Correct 179 ms 75464 KB Output is correct
61 Correct 163 ms 75464 KB Output is correct
62 Correct 165 ms 75384 KB Output is correct
63 Correct 166 ms 75412 KB Output is correct
64 Correct 13 ms 9816 KB Output is correct
65 Correct 10 ms 9644 KB Output is correct
66 Correct 10 ms 9816 KB Output is correct
67 Correct 10 ms 9800 KB Output is correct
68 Correct 675 ms 53400 KB Output is correct
69 Correct 939 ms 53660 KB Output is correct
70 Correct 912 ms 53448 KB Output is correct
71 Correct 932 ms 75464 KB Output is correct
72 Correct 1016 ms 75508 KB Output is correct
73 Correct 957 ms 75464 KB Output is correct
74 Correct 935 ms 75464 KB Output is correct
75 Correct 667 ms 9816 KB Output is correct
76 Correct 674 ms 9816 KB Output is correct
77 Correct 748 ms 9816 KB Output is correct
78 Correct 699 ms 9816 KB Output is correct
79 Correct 694 ms 9816 KB Output is correct
80 Correct 674 ms 9816 KB Output is correct
81 Correct 1 ms 4440 KB Output is correct
82 Correct 1 ms 4440 KB Output is correct
83 Correct 1 ms 4440 KB Output is correct
84 Correct 113 ms 53604 KB Output is correct
85 Correct 175 ms 75464 KB Output is correct
86 Correct 178 ms 75464 KB Output is correct
87 Correct 16 ms 10052 KB Output is correct
88 Correct 10 ms 9804 KB Output is correct
89 Correct 112 ms 53704 KB Output is correct
90 Correct 172 ms 75416 KB Output is correct
91 Correct 165 ms 75388 KB Output is correct
92 Correct 10 ms 9816 KB Output is correct
93 Correct 10 ms 9804 KB Output is correct
94 Correct 2 ms 6744 KB Output is correct
95 Correct 2 ms 6744 KB Output is correct
96 Correct 2 ms 6744 KB Output is correct
97 Correct 1 ms 4440 KB Output is correct
98 Correct 1 ms 4440 KB Output is correct
99 Correct 2 ms 6744 KB Output is correct
100 Correct 3 ms 6744 KB Output is correct
101 Correct 3 ms 6744 KB Output is correct
102 Correct 1 ms 4436 KB Output is correct
103 Correct 1 ms 4440 KB Output is correct
104 Correct 798 ms 48844 KB Output is correct
105 Correct 993 ms 53528 KB Output is correct
106 Correct 925 ms 53896 KB Output is correct
107 Correct 1008 ms 75464 KB Output is correct
108 Correct 1027 ms 75464 KB Output is correct
109 Correct 1002 ms 75464 KB Output is correct
110 Correct 963 ms 75464 KB Output is correct
111 Correct 684 ms 9816 KB Output is correct
112 Correct 686 ms 9816 KB Output is correct
113 Correct 717 ms 9816 KB Output is correct
114 Correct 761 ms 9816 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 344 ms 7256 KB Output is correct
2 Correct 724 ms 9816 KB Output is correct
3 Correct 693 ms 9816 KB Output is correct
4 Correct 668 ms 9816 KB Output is correct
5 Correct 729 ms 9816 KB Output is correct
6 Correct 685 ms 9816 KB Output is correct
7 Correct 667 ms 9816 KB Output is correct
8 Correct 1 ms 4440 KB Output is correct
9 Correct 1 ms 4440 KB Output is correct
10 Correct 1 ms 4440 KB Output is correct
11 Correct 1 ms 4440 KB Output is correct
12 Correct 3 ms 6744 KB Output is correct
13 Correct 3 ms 6744 KB Output is correct
14 Correct 3 ms 6888 KB Output is correct
15 Correct 2 ms 6744 KB Output is correct
16 Correct 3 ms 6744 KB Output is correct
17 Correct 3 ms 6744 KB Output is correct
18 Correct 1 ms 4652 KB Output is correct
19 Correct 1 ms 4440 KB Output is correct
20 Correct 1 ms 4440 KB Output is correct
21 Correct 1 ms 4440 KB Output is correct
22 Correct 1 ms 4440 KB Output is correct
23 Correct 1 ms 4440 KB Output is correct
24 Correct 1 ms 4440 KB Output is correct
25 Correct 2 ms 6744 KB Output is correct
26 Correct 3 ms 6744 KB Output is correct
27 Correct 2 ms 6744 KB Output is correct
28 Correct 1 ms 4440 KB Output is correct
29 Correct 1 ms 4440 KB Output is correct
30 Correct 2 ms 6744 KB Output is correct
31 Correct 2 ms 6744 KB Output is correct
32 Correct 3 ms 6744 KB Output is correct
33 Correct 1 ms 4440 KB Output is correct
34 Correct 1 ms 4440 KB Output is correct
35 Correct 1 ms 6744 KB Output is correct
36 Correct 2 ms 6744 KB Output is correct
37 Correct 2 ms 6744 KB Output is correct
38 Correct 3 ms 6744 KB Output is correct
39 Correct 3 ms 6744 KB Output is correct
40 Correct 3 ms 6744 KB Output is correct
41 Correct 2 ms 6744 KB Output is correct
42 Correct 1 ms 4440 KB Output is correct
43 Correct 1 ms 4440 KB Output is correct
44 Correct 1 ms 4440 KB Output is correct
45 Correct 1 ms 4440 KB Output is correct
46 Correct 71 ms 36572 KB Output is correct
47 Correct 113 ms 53712 KB Output is correct
48 Correct 106 ms 53704 KB Output is correct
49 Correct 176 ms 75464 KB Output is correct
50 Correct 185 ms 75464 KB Output is correct
51 Correct 182 ms 75464 KB Output is correct
52 Correct 163 ms 75464 KB Output is correct
53 Correct 10 ms 9816 KB Output is correct
54 Correct 10 ms 9800 KB Output is correct
55 Correct 10 ms 9816 KB Output is correct
56 Correct 11 ms 9812 KB Output is correct
57 Correct 103 ms 53704 KB Output is correct
58 Correct 161 ms 75468 KB Output is correct
59 Correct 166 ms 75464 KB Output is correct
60 Correct 10 ms 9816 KB Output is correct
61 Correct 10 ms 9836 KB Output is correct
62 Correct 105 ms 53708 KB Output is correct
63 Correct 195 ms 75464 KB Output is correct
64 Correct 170 ms 75464 KB Output is correct
65 Correct 10 ms 9816 KB Output is correct
66 Correct 10 ms 9816 KB Output is correct
67 Correct 96 ms 53456 KB Output is correct
68 Correct 98 ms 53704 KB Output is correct
69 Correct 104 ms 53716 KB Output is correct
70 Correct 179 ms 75464 KB Output is correct
71 Correct 163 ms 75464 KB Output is correct
72 Correct 165 ms 75384 KB Output is correct
73 Correct 166 ms 75412 KB Output is correct
74 Correct 13 ms 9816 KB Output is correct
75 Correct 10 ms 9644 KB Output is correct
76 Correct 10 ms 9816 KB Output is correct
77 Correct 10 ms 9800 KB Output is correct
78 Correct 675 ms 53400 KB Output is correct
79 Correct 939 ms 53660 KB Output is correct
80 Correct 912 ms 53448 KB Output is correct
81 Correct 932 ms 75464 KB Output is correct
82 Correct 1016 ms 75508 KB Output is correct
83 Correct 957 ms 75464 KB Output is correct
84 Correct 935 ms 75464 KB Output is correct
85 Correct 667 ms 9816 KB Output is correct
86 Correct 674 ms 9816 KB Output is correct
87 Correct 748 ms 9816 KB Output is correct
88 Correct 699 ms 9816 KB Output is correct
89 Correct 694 ms 9816 KB Output is correct
90 Correct 674 ms 9816 KB Output is correct
91 Correct 1 ms 4440 KB Output is correct
92 Correct 1 ms 4440 KB Output is correct
93 Correct 1 ms 4440 KB Output is correct
94 Correct 113 ms 53604 KB Output is correct
95 Correct 175 ms 75464 KB Output is correct
96 Correct 178 ms 75464 KB Output is correct
97 Correct 16 ms 10052 KB Output is correct
98 Correct 10 ms 9804 KB Output is correct
99 Correct 112 ms 53704 KB Output is correct
100 Correct 172 ms 75416 KB Output is correct
101 Correct 165 ms 75388 KB Output is correct
102 Correct 10 ms 9816 KB Output is correct
103 Correct 10 ms 9804 KB Output is correct
104 Correct 2 ms 6744 KB Output is correct
105 Correct 2 ms 6744 KB Output is correct
106 Correct 2 ms 6744 KB Output is correct
107 Correct 1 ms 4440 KB Output is correct
108 Correct 1 ms 4440 KB Output is correct
109 Correct 2 ms 6744 KB Output is correct
110 Correct 3 ms 6744 KB Output is correct
111 Correct 3 ms 6744 KB Output is correct
112 Correct 1 ms 4436 KB Output is correct
113 Correct 1 ms 4440 KB Output is correct
114 Correct 234 ms 16888 KB Output is correct
115 Correct 822 ms 53704 KB Output is correct
116 Correct 837 ms 53704 KB Output is correct
117 Correct 870 ms 75444 KB Output is correct
118 Correct 876 ms 75464 KB Output is correct
119 Correct 939 ms 75464 KB Output is correct
120 Correct 913 ms 75464 KB Output is correct
121 Correct 684 ms 9816 KB Output is correct
122 Correct 727 ms 9816 KB Output is correct
123 Correct 690 ms 9816 KB Output is correct
124 Correct 699 ms 9816 KB Output is correct
125 Correct 109 ms 53700 KB Output is correct
126 Correct 183 ms 75608 KB Output is correct
127 Correct 163 ms 75400 KB Output is correct
128 Correct 10 ms 9816 KB Output is correct
129 Correct 10 ms 9816 KB Output is correct
130 Correct 95 ms 53552 KB Output is correct
131 Correct 113 ms 53816 KB Output is correct
132 Correct 110 ms 53712 KB Output is correct
133 Correct 170 ms 75456 KB Output is correct
134 Correct 168 ms 75464 KB Output is correct
135 Correct 175 ms 75460 KB Output is correct
136 Correct 159 ms 75572 KB Output is correct
137 Correct 9 ms 9816 KB Output is correct
138 Correct 9 ms 9816 KB Output is correct
139 Correct 16 ms 9816 KB Output is correct
140 Correct 10 ms 9652 KB Output is correct
141 Correct 2 ms 6744 KB Output is correct
142 Correct 2 ms 6744 KB Output is correct
143 Correct 3 ms 6744 KB Output is correct
144 Correct 1 ms 4440 KB Output is correct
145 Correct 1 ms 4440 KB Output is correct
146 Correct 1 ms 6744 KB Output is correct
147 Correct 2 ms 6744 KB Output is correct
148 Correct 2 ms 6744 KB Output is correct
149 Correct 2 ms 6744 KB Output is correct
150 Correct 3 ms 6744 KB Output is correct
151 Correct 2 ms 6744 KB Output is correct
152 Correct 2 ms 6744 KB Output is correct
153 Correct 1 ms 4440 KB Output is correct
154 Correct 1 ms 4440 KB Output is correct
155 Correct 1 ms 4440 KB Output is correct
156 Correct 1 ms 4440 KB Output is correct
157 Correct 798 ms 48844 KB Output is correct
158 Correct 993 ms 53528 KB Output is correct
159 Correct 925 ms 53896 KB Output is correct
160 Correct 1008 ms 75464 KB Output is correct
161 Correct 1027 ms 75464 KB Output is correct
162 Correct 1002 ms 75464 KB Output is correct
163 Correct 963 ms 75464 KB Output is correct
164 Correct 684 ms 9816 KB Output is correct
165 Correct 686 ms 9816 KB Output is correct
166 Correct 717 ms 9816 KB Output is correct
167 Correct 761 ms 9816 KB Output is correct
168 Correct 1 ms 4440 KB Output is correct
169 Correct 560 ms 21904 KB Output is correct
170 Correct 1006 ms 53444 KB Output is correct
171 Correct 980 ms 53776 KB Output is correct
172 Correct 1092 ms 75460 KB Output is correct
173 Correct 1031 ms 75464 KB Output is correct
174 Correct 1095 ms 75520 KB Output is correct
175 Correct 1088 ms 75432 KB Output is correct
176 Correct 691 ms 9800 KB Output is correct
177 Correct 672 ms 9816 KB Output is correct
178 Correct 709 ms 9816 KB Output is correct
179 Correct 690 ms 9816 KB Output is correct