Submission #1054915

# Submission time Handle Problem Language Result Execution time Memory
1054915 2024-08-12T13:01:26 Z shiomusubi496 Radio Towers (IOI22_towers) C++17
100 / 100
1238 ms 201288 KB
#include "towers.h"
#include <bits/stdc++.h>

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rep2(i, a, b) for (int i = (int)(a); i < (int)(b); ++i)
#define rrep(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define rrep2(i, a, b) for (int i = (int)(b) - 1; i >= (int)(a); --i)

#define all(v) begin(v), end(v)
#define rall(v) rbegin(v), rend(v)

using namespace std;

using ll = long long;

template<class T, class U> bool chmin(T& a, const U& b) { return a > b ? a = b, true : false; }
template<class T, class U> bool chmax(T& a, const U& b) { return a < b ? a = b, true : false; }

constexpr ll inf = 1e18;

template<class M>
class SegmentTree {
    using T = typename M::T;
    int n;
    vector<T> dat;

public:
    SegmentTree() = default;
    SegmentTree(int n_, T x) {
        n = 1;
        while (n < n_) n *= 2;
        dat.assign(2 * n, x);
    }
    SegmentTree(vector<T> a) {
        n = 1;
        while (n < a.size()) n *= 2;
        dat.assign(2 * n, M::id());
        rep (i, a.size()) dat[i + n] = a[i];
        rrep2 (i, 1, n) dat[i] = M::op(dat[2 * i], dat[2 * i + 1]);
    }
    void set(int k, T x) {
        k += n;
        dat[k] = x;
        while (k > 1) {
            k /= 2;
            dat[k] = M::op(dat[2 * k], dat[2 * k + 1]);
        }
    }
    void apply(int k, T x) { set(k, M::op(dat[k + n], x)); }
    T prod(int l, int r) const {
        l += n; r += n;
        T lsm = M::id(), rsm = M::id();
        while (l < r) {
            if (l & 1) lsm = M::op(lsm, dat[l++]);
            if (r & 1) rsm = M::op(dat[--r], rsm);
            l >>= 1; r >>= 1;
        }
        return M::op(lsm, rsm);
    }
    T all_prod() const { return dat[1]; }
    T get(int k) const { return dat[k + n]; }
};

template<class M>
class PersistentSegmentTree {
    using T = typename M::T;
    int n;

public:
    struct Node;
    using node_ptr = Node*;
    struct Node {
        T val;
        node_ptr l, r;
        Node(T val_ = M::id(), node_ptr l_ = nullptr, node_ptr r_ = nullptr) : val(val_), l(l_), r(r_) {}
    };

private:
    node_ptr root;

public:
    PersistentSegmentTree() = default;
    void init(int n_, T x = M::id()) {
        n = 1;
        while (n < n_) n *= 2;
        vector<node_ptr> nodes(n * 2);
        rep (i, 2 * n) nodes[i] = new Node();
        rep (i, n_) nodes[i + n]->val = x;
        rrep2 (i, 1, n) nodes[i]->val = M::op(nodes[i * 2]->val, nodes[i * 2 + 1]->val);
        rep2 (i, 1, n) nodes[i]->l = nodes[i * 2], nodes[i]->r = nodes[i * 2 + 1];
        root = nodes[1];
    }

private:
    node_ptr set_(node_ptr p, int k, int bt, T x) {
        if (bt == 0) return new Node(x, p->l, p->r);
        if (k & bt) {
            auto ptr = set_(p->r, k, bt / 2, x);
            return new Node(M::op(p->l->val, ptr->val), p->l, ptr);
        }
        else {
            auto ptr = set_(p->l, k, bt / 2, x);
            return new Node(M::op(ptr->val, p->r->val), ptr, p->r);
        }
    }

public:
    void set(int k, T x) {
        root = set_(root, k, n / 2, x);
    }

private:
    T prod_(node_ptr p, int l, int r, int a, int b) const {
        if (r <= a || b <= l) return M::id();
        if (a <= l && r <= b) return p->val;
        return M::op(prod_(p->l, l, (l + r) / 2, a, b), prod_(p->r, (l + r) / 2, r, a, b));
    }

public:
    T prod(node_ptr ptr, int l, int r) const {
        return prod_(ptr, 0, n, l, r);
    }
    T prod(int l, int r) const { return prod(root, l, r); }
    T all_prod(node_ptr ptr) const { return ptr->val; }
    T all_prod() const { return all_prod(root); }
    node_ptr get_root() const { return root; }
};

struct Max {
    using T = ll;
    static T op(T a, T b) { return max(a, b); }
    static T id() { return -inf; }
};

struct Min {
    using T = ll;
    static T op(T a, T b) { return min(a, b); }
    static T id() { return inf; }
};

struct Sum {
    using T = ll;
    static T op(T a, T b) { return a + b; }
    static T id() { return 0; }
};

struct Monoid {
    using T = tuple<ll, ll, ll>;
    static T op(T a, T b) {
        auto [a1, a2, a3] = a;
        auto [b1, b2, b3] = b;
        return {a1 + b1, min(a2, b2), max(a3, b3)};
    }
    static T id() { return {0, inf, -inf}; }
};

int N;
vector<int> H, Hs;

PersistentSegmentTree<Monoid> seg1, seg2;
SegmentTree<Min> rmq;

using node_ptr = PersistentSegmentTree<Monoid>::node_ptr;

vector<node_ptr> ptr1, ptr2;
vector<ll> stamps;

void init(int N_, std::vector<int> H_) {
    N = N_; H = H_;
    Hs = H;
    stamps = {};
    ptr1 = ptr2 = {};
    sort(all(Hs));
    Hs.erase(unique(all(Hs)), Hs.end());
    rep (i, N) H[i] = lower_bound(all(Hs), H[i]) - Hs.begin();

    rmq = SegmentTree<Min>(N, inf);
    rep (i, N) rmq.set(i, H[i]);

    seg1.init(N);
    seg2.init(N);
    rep (i, N) {
        if ((i == 0 || H[i - 1] > H[i]) && (i == N - 1 || H[i] < H[i + 1])) seg1.set(i, {1, i, i});
    }
    rep (i, N) {
        if ((i == 0 || H[i - 1] < H[i]) && (i == N - 1 || H[i] > H[i + 1])) seg2.set(i, {1, i, i});
    }
    priority_queue<pair<ll, int>, vector<pair<ll, int>>, greater<>> que;
    rep (i, N) {
        if (get<0>(seg2.prod(i, i + 1)) == 1) {
            auto [s1, l1, r1] = seg1.prod(0, i);
            auto [s2, l2, r2] = seg1.prod(i + 1, N);
            ll t = -inf;
            if (s1 != 0) chmax(t, Hs[H[r1]]);
            if (s2 != 0) chmax(t, Hs[H[l2]]);
            que.emplace(Hs[H[i]] - t, i);
        }
    }
    while (!que.empty()) {
        auto [d, k] = que.top(); que.pop();
        // if (d >= D) break;
        stamps.push_back(d);
        ptr1.push_back(seg1.get_root());
        ptr2.push_back(seg2.get_root());
        if (get<0>(seg2.prod(k, k + 1)) == 0) continue;
        auto [s1, l1, r1] = seg1.prod(0, k);
        auto [s2, l2, r2] = seg1.prod(k + 1, N);
        {
            ll t = -inf;
            if (s1 != 0) chmax(t, Hs[H[r1]]);
            if (s2 != 0) chmax(t, Hs[H[l2]]);
            if (d != Hs[H[k]] - t) continue;
        }
        if (s1 == 0 && s2 == 0) continue;
        if (s1 == 0 || (s2 != 0 && H[r1] < H[l2])) {
            seg1.set(l2, {0, inf, -inf});
            seg2.set(k, {0, inf, -inf});
            auto [s, l, r] = seg2.prod(k + 1, N);
            if (s == 0) continue;
            auto [s3, l3, r3] = seg1.prod(l + 1, N);
            ll t = -inf;
            if (s1 != 0) chmax(t, Hs[H[r1]]);
            if (s3 != 0) chmax(t, Hs[H[l3]]);
            que.emplace(Hs[H[l]] - t, l);
        }
        else {
            seg1.set(r1, {0, inf, -inf});
            seg2.set(k, {0, inf, -inf});
            auto [s, l, r] = seg2.prod(0, k);
            if (s == 0) continue;
            auto [s3, l3, r3] = seg1.prod(0, r);
            ll t = -inf;
            if (s2 != 0) chmax(t, Hs[H[l2]]);
            if (s3 != 0) chmax(t, Hs[H[r3]]);
            que.emplace(Hs[H[r]] - t, r);
        }
    }
    int inf = 1.1e9;
    stamps.push_back(inf);
    ptr1.push_back(seg1.get_root());
    ptr2.push_back(seg2.get_root());
}

int max_towers(int L, int R, int D) {
    auto itr = lower_bound(all(stamps), D) - stamps.begin();
    ++R;
    auto [s, l, r] = seg2.prod(ptr2[itr], L, R);
    if (s == 0) return 1;
    int res = s - 1;
    if (l != L && Hs[rmq.prod(L, l)] + D <= Hs[H[l]]) ++res;
    if (r != R - 1 && Hs[rmq.prod(r + 1, R)] + D <= Hs[H[r]]) ++res;
    return max(res, 1);
}
# Verdict Execution time Memory Grader output
1 Correct 369 ms 15700 KB Output is correct
2 Correct 654 ms 30480 KB Output is correct
3 Correct 660 ms 30540 KB Output is correct
4 Correct 624 ms 30548 KB Output is correct
5 Correct 697 ms 30540 KB Output is correct
6 Correct 689 ms 30540 KB Output is correct
7 Correct 605 ms 30508 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 1 ms 856 KB Output is correct
10 Correct 1 ms 856 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 600 KB Output is correct
2 Correct 4 ms 2392 KB Output is correct
3 Correct 3 ms 2392 KB Output is correct
4 Correct 4 ms 3160 KB Output is correct
5 Correct 4 ms 3160 KB Output is correct
6 Correct 4 ms 3160 KB Output is correct
7 Correct 4 ms 3160 KB Output is correct
8 Correct 1 ms 856 KB Output is correct
9 Correct 1 ms 856 KB Output is correct
10 Correct 1 ms 856 KB Output is correct
11 Correct 1 ms 856 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 1 ms 856 KB Output is correct
14 Correct 1 ms 856 KB Output is correct
15 Correct 3 ms 2392 KB Output is correct
16 Correct 3 ms 3160 KB Output is correct
17 Correct 3 ms 3088 KB Output is correct
18 Correct 1 ms 856 KB Output is correct
19 Correct 1 ms 856 KB Output is correct
20 Correct 3 ms 2392 KB Output is correct
21 Correct 4 ms 3192 KB Output is correct
22 Correct 4 ms 3008 KB Output is correct
23 Correct 1 ms 1108 KB Output is correct
24 Correct 1 ms 856 KB Output is correct
25 Correct 1 ms 1112 KB Output is correct
26 Correct 3 ms 2228 KB Output is correct
27 Correct 4 ms 2392 KB Output is correct
28 Correct 3 ms 3160 KB Output is correct
29 Correct 4 ms 3160 KB Output is correct
30 Correct 4 ms 3160 KB Output is correct
31 Correct 4 ms 2984 KB Output is correct
32 Correct 1 ms 856 KB Output is correct
33 Correct 1 ms 724 KB Output is correct
34 Correct 1 ms 856 KB Output is correct
35 Correct 1 ms 856 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 600 KB Output is correct
2 Correct 4 ms 2392 KB Output is correct
3 Correct 3 ms 2392 KB Output is correct
4 Correct 4 ms 3160 KB Output is correct
5 Correct 4 ms 3160 KB Output is correct
6 Correct 4 ms 3160 KB Output is correct
7 Correct 4 ms 3160 KB Output is correct
8 Correct 1 ms 856 KB Output is correct
9 Correct 1 ms 856 KB Output is correct
10 Correct 1 ms 856 KB Output is correct
11 Correct 1 ms 856 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 1 ms 856 KB Output is correct
14 Correct 1 ms 856 KB Output is correct
15 Correct 3 ms 2392 KB Output is correct
16 Correct 3 ms 3160 KB Output is correct
17 Correct 3 ms 3088 KB Output is correct
18 Correct 1 ms 856 KB Output is correct
19 Correct 1 ms 856 KB Output is correct
20 Correct 3 ms 2392 KB Output is correct
21 Correct 4 ms 3192 KB Output is correct
22 Correct 4 ms 3008 KB Output is correct
23 Correct 1 ms 1108 KB Output is correct
24 Correct 1 ms 856 KB Output is correct
25 Correct 1 ms 1112 KB Output is correct
26 Correct 3 ms 2228 KB Output is correct
27 Correct 4 ms 2392 KB Output is correct
28 Correct 3 ms 3160 KB Output is correct
29 Correct 4 ms 3160 KB Output is correct
30 Correct 4 ms 3160 KB Output is correct
31 Correct 4 ms 2984 KB Output is correct
32 Correct 1 ms 856 KB Output is correct
33 Correct 1 ms 724 KB Output is correct
34 Correct 1 ms 856 KB Output is correct
35 Correct 1 ms 856 KB Output is correct
36 Correct 144 ms 85280 KB Output is correct
37 Correct 260 ms 144200 KB Output is correct
38 Correct 252 ms 143692 KB Output is correct
39 Correct 347 ms 200952 KB Output is correct
40 Correct 350 ms 201028 KB Output is correct
41 Correct 343 ms 200984 KB Output is correct
42 Correct 370 ms 200900 KB Output is correct
43 Correct 47 ms 30540 KB Output is correct
44 Correct 43 ms 30716 KB Output is correct
45 Correct 43 ms 30540 KB Output is correct
46 Correct 66 ms 30540 KB Output is correct
47 Correct 297 ms 143688 KB Output is correct
48 Correct 356 ms 201032 KB Output is correct
49 Correct 368 ms 200904 KB Output is correct
50 Correct 42 ms 30548 KB Output is correct
51 Correct 42 ms 30548 KB Output is correct
52 Correct 253 ms 143636 KB Output is correct
53 Correct 334 ms 201032 KB Output is correct
54 Correct 344 ms 201288 KB Output is correct
55 Correct 42 ms 30548 KB Output is correct
56 Correct 43 ms 30548 KB Output is correct
57 Correct 247 ms 139488 KB Output is correct
58 Correct 254 ms 143872 KB Output is correct
59 Correct 252 ms 144200 KB Output is correct
60 Correct 416 ms 201096 KB Output is correct
61 Correct 332 ms 201076 KB Output is correct
62 Correct 345 ms 200924 KB Output is correct
63 Correct 337 ms 200904 KB Output is correct
64 Correct 49 ms 30512 KB Output is correct
65 Correct 42 ms 30540 KB Output is correct
66 Correct 43 ms 30548 KB Output is correct
67 Correct 42 ms 30540 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 717 ms 142920 KB Output is correct
2 Correct 862 ms 143944 KB Output is correct
3 Correct 899 ms 143944 KB Output is correct
4 Correct 963 ms 201032 KB Output is correct
5 Correct 1006 ms 201032 KB Output is correct
6 Correct 956 ms 200988 KB Output is correct
7 Correct 967 ms 201192 KB Output is correct
8 Correct 601 ms 30540 KB Output is correct
9 Correct 631 ms 30540 KB Output is correct
10 Correct 637 ms 30548 KB Output is correct
11 Correct 634 ms 30548 KB Output is correct
12 Correct 615 ms 30540 KB Output is correct
13 Correct 612 ms 30540 KB Output is correct
14 Correct 0 ms 344 KB Output is correct
15 Correct 1 ms 856 KB Output is correct
16 Correct 1 ms 856 KB Output is correct
17 Correct 244 ms 143592 KB Output is correct
18 Correct 342 ms 201008 KB Output is correct
19 Correct 343 ms 201008 KB Output is correct
20 Correct 44 ms 30540 KB Output is correct
21 Correct 41 ms 30548 KB Output is correct
22 Correct 238 ms 143692 KB Output is correct
23 Correct 338 ms 201068 KB Output is correct
24 Correct 350 ms 201032 KB Output is correct
25 Correct 41 ms 30548 KB Output is correct
26 Correct 42 ms 30524 KB Output is correct
27 Correct 3 ms 2388 KB Output is correct
28 Correct 3 ms 3192 KB Output is correct
29 Correct 4 ms 3156 KB Output is correct
30 Correct 1 ms 856 KB Output is correct
31 Correct 1 ms 856 KB Output is correct
32 Correct 4 ms 2392 KB Output is correct
33 Correct 3 ms 3160 KB Output is correct
34 Correct 4 ms 3160 KB Output is correct
35 Correct 1 ms 880 KB Output is correct
36 Correct 1 ms 856 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 207 ms 31828 KB Output is correct
2 Correct 827 ms 143944 KB Output is correct
3 Correct 870 ms 143944 KB Output is correct
4 Correct 954 ms 201032 KB Output is correct
5 Correct 855 ms 201028 KB Output is correct
6 Correct 914 ms 200908 KB Output is correct
7 Correct 895 ms 201232 KB Output is correct
8 Correct 608 ms 30540 KB Output is correct
9 Correct 568 ms 30540 KB Output is correct
10 Correct 572 ms 30548 KB Output is correct
11 Correct 617 ms 30720 KB Output is correct
12 Correct 242 ms 143632 KB Output is correct
13 Correct 330 ms 200956 KB Output is correct
14 Correct 342 ms 201032 KB Output is correct
15 Correct 43 ms 30504 KB Output is correct
16 Correct 47 ms 30676 KB Output is correct
17 Correct 250 ms 139592 KB Output is correct
18 Correct 268 ms 143944 KB Output is correct
19 Correct 248 ms 144196 KB Output is correct
20 Correct 342 ms 200976 KB Output is correct
21 Correct 387 ms 201032 KB Output is correct
22 Correct 367 ms 200888 KB Output is correct
23 Correct 383 ms 201128 KB Output is correct
24 Correct 63 ms 30536 KB Output is correct
25 Correct 48 ms 30548 KB Output is correct
26 Correct 52 ms 30508 KB Output is correct
27 Correct 51 ms 30716 KB Output is correct
28 Correct 3 ms 2392 KB Output is correct
29 Correct 3 ms 3024 KB Output is correct
30 Correct 5 ms 3160 KB Output is correct
31 Correct 1 ms 856 KB Output is correct
32 Correct 1 ms 856 KB Output is correct
33 Correct 1 ms 1136 KB Output is correct
34 Correct 3 ms 2392 KB Output is correct
35 Correct 3 ms 2392 KB Output is correct
36 Correct 4 ms 3140 KB Output is correct
37 Correct 5 ms 2944 KB Output is correct
38 Correct 3 ms 3160 KB Output is correct
39 Correct 4 ms 3160 KB Output is correct
40 Correct 1 ms 856 KB Output is correct
41 Correct 1 ms 856 KB Output is correct
42 Correct 2 ms 856 KB Output is correct
43 Correct 1 ms 856 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 600 KB Output is correct
2 Correct 4 ms 2392 KB Output is correct
3 Correct 3 ms 2392 KB Output is correct
4 Correct 4 ms 3160 KB Output is correct
5 Correct 4 ms 3160 KB Output is correct
6 Correct 4 ms 3160 KB Output is correct
7 Correct 4 ms 3160 KB Output is correct
8 Correct 1 ms 856 KB Output is correct
9 Correct 1 ms 856 KB Output is correct
10 Correct 1 ms 856 KB Output is correct
11 Correct 1 ms 856 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 1 ms 856 KB Output is correct
14 Correct 1 ms 856 KB Output is correct
15 Correct 3 ms 2392 KB Output is correct
16 Correct 3 ms 3160 KB Output is correct
17 Correct 3 ms 3088 KB Output is correct
18 Correct 1 ms 856 KB Output is correct
19 Correct 1 ms 856 KB Output is correct
20 Correct 3 ms 2392 KB Output is correct
21 Correct 4 ms 3192 KB Output is correct
22 Correct 4 ms 3008 KB Output is correct
23 Correct 1 ms 1108 KB Output is correct
24 Correct 1 ms 856 KB Output is correct
25 Correct 1 ms 1112 KB Output is correct
26 Correct 3 ms 2228 KB Output is correct
27 Correct 4 ms 2392 KB Output is correct
28 Correct 3 ms 3160 KB Output is correct
29 Correct 4 ms 3160 KB Output is correct
30 Correct 4 ms 3160 KB Output is correct
31 Correct 4 ms 2984 KB Output is correct
32 Correct 1 ms 856 KB Output is correct
33 Correct 1 ms 724 KB Output is correct
34 Correct 1 ms 856 KB Output is correct
35 Correct 1 ms 856 KB Output is correct
36 Correct 144 ms 85280 KB Output is correct
37 Correct 260 ms 144200 KB Output is correct
38 Correct 252 ms 143692 KB Output is correct
39 Correct 347 ms 200952 KB Output is correct
40 Correct 350 ms 201028 KB Output is correct
41 Correct 343 ms 200984 KB Output is correct
42 Correct 370 ms 200900 KB Output is correct
43 Correct 47 ms 30540 KB Output is correct
44 Correct 43 ms 30716 KB Output is correct
45 Correct 43 ms 30540 KB Output is correct
46 Correct 66 ms 30540 KB Output is correct
47 Correct 297 ms 143688 KB Output is correct
48 Correct 356 ms 201032 KB Output is correct
49 Correct 368 ms 200904 KB Output is correct
50 Correct 42 ms 30548 KB Output is correct
51 Correct 42 ms 30548 KB Output is correct
52 Correct 253 ms 143636 KB Output is correct
53 Correct 334 ms 201032 KB Output is correct
54 Correct 344 ms 201288 KB Output is correct
55 Correct 42 ms 30548 KB Output is correct
56 Correct 43 ms 30548 KB Output is correct
57 Correct 247 ms 139488 KB Output is correct
58 Correct 254 ms 143872 KB Output is correct
59 Correct 252 ms 144200 KB Output is correct
60 Correct 416 ms 201096 KB Output is correct
61 Correct 332 ms 201076 KB Output is correct
62 Correct 345 ms 200924 KB Output is correct
63 Correct 337 ms 200904 KB Output is correct
64 Correct 49 ms 30512 KB Output is correct
65 Correct 42 ms 30540 KB Output is correct
66 Correct 43 ms 30548 KB Output is correct
67 Correct 42 ms 30540 KB Output is correct
68 Correct 717 ms 142920 KB Output is correct
69 Correct 862 ms 143944 KB Output is correct
70 Correct 899 ms 143944 KB Output is correct
71 Correct 963 ms 201032 KB Output is correct
72 Correct 1006 ms 201032 KB Output is correct
73 Correct 956 ms 200988 KB Output is correct
74 Correct 967 ms 201192 KB Output is correct
75 Correct 601 ms 30540 KB Output is correct
76 Correct 631 ms 30540 KB Output is correct
77 Correct 637 ms 30548 KB Output is correct
78 Correct 634 ms 30548 KB Output is correct
79 Correct 615 ms 30540 KB Output is correct
80 Correct 612 ms 30540 KB Output is correct
81 Correct 0 ms 344 KB Output is correct
82 Correct 1 ms 856 KB Output is correct
83 Correct 1 ms 856 KB Output is correct
84 Correct 244 ms 143592 KB Output is correct
85 Correct 342 ms 201008 KB Output is correct
86 Correct 343 ms 201008 KB Output is correct
87 Correct 44 ms 30540 KB Output is correct
88 Correct 41 ms 30548 KB Output is correct
89 Correct 238 ms 143692 KB Output is correct
90 Correct 338 ms 201068 KB Output is correct
91 Correct 350 ms 201032 KB Output is correct
92 Correct 41 ms 30548 KB Output is correct
93 Correct 42 ms 30524 KB Output is correct
94 Correct 3 ms 2388 KB Output is correct
95 Correct 3 ms 3192 KB Output is correct
96 Correct 4 ms 3156 KB Output is correct
97 Correct 1 ms 856 KB Output is correct
98 Correct 1 ms 856 KB Output is correct
99 Correct 4 ms 2392 KB Output is correct
100 Correct 3 ms 3160 KB Output is correct
101 Correct 4 ms 3160 KB Output is correct
102 Correct 1 ms 880 KB Output is correct
103 Correct 1 ms 856 KB Output is correct
104 Correct 780 ms 130712 KB Output is correct
105 Correct 877 ms 143556 KB Output is correct
106 Correct 909 ms 144088 KB Output is correct
107 Correct 960 ms 200992 KB Output is correct
108 Correct 988 ms 201072 KB Output is correct
109 Correct 967 ms 201008 KB Output is correct
110 Correct 1008 ms 200928 KB Output is correct
111 Correct 636 ms 30540 KB Output is correct
112 Correct 664 ms 30540 KB Output is correct
113 Correct 646 ms 30548 KB Output is correct
114 Correct 700 ms 30540 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 369 ms 15700 KB Output is correct
2 Correct 654 ms 30480 KB Output is correct
3 Correct 660 ms 30540 KB Output is correct
4 Correct 624 ms 30548 KB Output is correct
5 Correct 697 ms 30540 KB Output is correct
6 Correct 689 ms 30540 KB Output is correct
7 Correct 605 ms 30508 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 1 ms 856 KB Output is correct
10 Correct 1 ms 856 KB Output is correct
11 Correct 1 ms 600 KB Output is correct
12 Correct 4 ms 2392 KB Output is correct
13 Correct 3 ms 2392 KB Output is correct
14 Correct 4 ms 3160 KB Output is correct
15 Correct 4 ms 3160 KB Output is correct
16 Correct 4 ms 3160 KB Output is correct
17 Correct 4 ms 3160 KB Output is correct
18 Correct 1 ms 856 KB Output is correct
19 Correct 1 ms 856 KB Output is correct
20 Correct 1 ms 856 KB Output is correct
21 Correct 1 ms 856 KB Output is correct
22 Correct 0 ms 344 KB Output is correct
23 Correct 1 ms 856 KB Output is correct
24 Correct 1 ms 856 KB Output is correct
25 Correct 3 ms 2392 KB Output is correct
26 Correct 3 ms 3160 KB Output is correct
27 Correct 3 ms 3088 KB Output is correct
28 Correct 1 ms 856 KB Output is correct
29 Correct 1 ms 856 KB Output is correct
30 Correct 3 ms 2392 KB Output is correct
31 Correct 4 ms 3192 KB Output is correct
32 Correct 4 ms 3008 KB Output is correct
33 Correct 1 ms 1108 KB Output is correct
34 Correct 1 ms 856 KB Output is correct
35 Correct 1 ms 1112 KB Output is correct
36 Correct 3 ms 2228 KB Output is correct
37 Correct 4 ms 2392 KB Output is correct
38 Correct 3 ms 3160 KB Output is correct
39 Correct 4 ms 3160 KB Output is correct
40 Correct 4 ms 3160 KB Output is correct
41 Correct 4 ms 2984 KB Output is correct
42 Correct 1 ms 856 KB Output is correct
43 Correct 1 ms 724 KB Output is correct
44 Correct 1 ms 856 KB Output is correct
45 Correct 1 ms 856 KB Output is correct
46 Correct 144 ms 85280 KB Output is correct
47 Correct 260 ms 144200 KB Output is correct
48 Correct 252 ms 143692 KB Output is correct
49 Correct 347 ms 200952 KB Output is correct
50 Correct 350 ms 201028 KB Output is correct
51 Correct 343 ms 200984 KB Output is correct
52 Correct 370 ms 200900 KB Output is correct
53 Correct 47 ms 30540 KB Output is correct
54 Correct 43 ms 30716 KB Output is correct
55 Correct 43 ms 30540 KB Output is correct
56 Correct 66 ms 30540 KB Output is correct
57 Correct 297 ms 143688 KB Output is correct
58 Correct 356 ms 201032 KB Output is correct
59 Correct 368 ms 200904 KB Output is correct
60 Correct 42 ms 30548 KB Output is correct
61 Correct 42 ms 30548 KB Output is correct
62 Correct 253 ms 143636 KB Output is correct
63 Correct 334 ms 201032 KB Output is correct
64 Correct 344 ms 201288 KB Output is correct
65 Correct 42 ms 30548 KB Output is correct
66 Correct 43 ms 30548 KB Output is correct
67 Correct 247 ms 139488 KB Output is correct
68 Correct 254 ms 143872 KB Output is correct
69 Correct 252 ms 144200 KB Output is correct
70 Correct 416 ms 201096 KB Output is correct
71 Correct 332 ms 201076 KB Output is correct
72 Correct 345 ms 200924 KB Output is correct
73 Correct 337 ms 200904 KB Output is correct
74 Correct 49 ms 30512 KB Output is correct
75 Correct 42 ms 30540 KB Output is correct
76 Correct 43 ms 30548 KB Output is correct
77 Correct 42 ms 30540 KB Output is correct
78 Correct 717 ms 142920 KB Output is correct
79 Correct 862 ms 143944 KB Output is correct
80 Correct 899 ms 143944 KB Output is correct
81 Correct 963 ms 201032 KB Output is correct
82 Correct 1006 ms 201032 KB Output is correct
83 Correct 956 ms 200988 KB Output is correct
84 Correct 967 ms 201192 KB Output is correct
85 Correct 601 ms 30540 KB Output is correct
86 Correct 631 ms 30540 KB Output is correct
87 Correct 637 ms 30548 KB Output is correct
88 Correct 634 ms 30548 KB Output is correct
89 Correct 615 ms 30540 KB Output is correct
90 Correct 612 ms 30540 KB Output is correct
91 Correct 0 ms 344 KB Output is correct
92 Correct 1 ms 856 KB Output is correct
93 Correct 1 ms 856 KB Output is correct
94 Correct 244 ms 143592 KB Output is correct
95 Correct 342 ms 201008 KB Output is correct
96 Correct 343 ms 201008 KB Output is correct
97 Correct 44 ms 30540 KB Output is correct
98 Correct 41 ms 30548 KB Output is correct
99 Correct 238 ms 143692 KB Output is correct
100 Correct 338 ms 201068 KB Output is correct
101 Correct 350 ms 201032 KB Output is correct
102 Correct 41 ms 30548 KB Output is correct
103 Correct 42 ms 30524 KB Output is correct
104 Correct 3 ms 2388 KB Output is correct
105 Correct 3 ms 3192 KB Output is correct
106 Correct 4 ms 3156 KB Output is correct
107 Correct 1 ms 856 KB Output is correct
108 Correct 1 ms 856 KB Output is correct
109 Correct 4 ms 2392 KB Output is correct
110 Correct 3 ms 3160 KB Output is correct
111 Correct 4 ms 3160 KB Output is correct
112 Correct 1 ms 880 KB Output is correct
113 Correct 1 ms 856 KB Output is correct
114 Correct 207 ms 31828 KB Output is correct
115 Correct 827 ms 143944 KB Output is correct
116 Correct 870 ms 143944 KB Output is correct
117 Correct 954 ms 201032 KB Output is correct
118 Correct 855 ms 201028 KB Output is correct
119 Correct 914 ms 200908 KB Output is correct
120 Correct 895 ms 201232 KB Output is correct
121 Correct 608 ms 30540 KB Output is correct
122 Correct 568 ms 30540 KB Output is correct
123 Correct 572 ms 30548 KB Output is correct
124 Correct 617 ms 30720 KB Output is correct
125 Correct 242 ms 143632 KB Output is correct
126 Correct 330 ms 200956 KB Output is correct
127 Correct 342 ms 201032 KB Output is correct
128 Correct 43 ms 30504 KB Output is correct
129 Correct 47 ms 30676 KB Output is correct
130 Correct 250 ms 139592 KB Output is correct
131 Correct 268 ms 143944 KB Output is correct
132 Correct 248 ms 144196 KB Output is correct
133 Correct 342 ms 200976 KB Output is correct
134 Correct 387 ms 201032 KB Output is correct
135 Correct 367 ms 200888 KB Output is correct
136 Correct 383 ms 201128 KB Output is correct
137 Correct 63 ms 30536 KB Output is correct
138 Correct 48 ms 30548 KB Output is correct
139 Correct 52 ms 30508 KB Output is correct
140 Correct 51 ms 30716 KB Output is correct
141 Correct 3 ms 2392 KB Output is correct
142 Correct 3 ms 3024 KB Output is correct
143 Correct 5 ms 3160 KB Output is correct
144 Correct 1 ms 856 KB Output is correct
145 Correct 1 ms 856 KB Output is correct
146 Correct 1 ms 1136 KB Output is correct
147 Correct 3 ms 2392 KB Output is correct
148 Correct 3 ms 2392 KB Output is correct
149 Correct 4 ms 3140 KB Output is correct
150 Correct 5 ms 2944 KB Output is correct
151 Correct 3 ms 3160 KB Output is correct
152 Correct 4 ms 3160 KB Output is correct
153 Correct 1 ms 856 KB Output is correct
154 Correct 1 ms 856 KB Output is correct
155 Correct 2 ms 856 KB Output is correct
156 Correct 1 ms 856 KB Output is correct
157 Correct 780 ms 130712 KB Output is correct
158 Correct 877 ms 143556 KB Output is correct
159 Correct 909 ms 144088 KB Output is correct
160 Correct 960 ms 200992 KB Output is correct
161 Correct 988 ms 201072 KB Output is correct
162 Correct 967 ms 201008 KB Output is correct
163 Correct 1008 ms 200928 KB Output is correct
164 Correct 636 ms 30540 KB Output is correct
165 Correct 664 ms 30540 KB Output is correct
166 Correct 646 ms 30548 KB Output is correct
167 Correct 700 ms 30540 KB Output is correct
168 Correct 0 ms 344 KB Output is correct
169 Correct 553 ms 52108 KB Output is correct
170 Correct 980 ms 143176 KB Output is correct
171 Correct 1008 ms 143688 KB Output is correct
172 Correct 1192 ms 200904 KB Output is correct
173 Correct 1109 ms 200884 KB Output is correct
174 Correct 1163 ms 201032 KB Output is correct
175 Correct 1238 ms 200888 KB Output is correct
176 Correct 615 ms 30540 KB Output is correct
177 Correct 672 ms 30540 KB Output is correct
178 Correct 633 ms 30712 KB Output is correct
179 Correct 579 ms 30724 KB Output is correct