답안 #1079489

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1079489 2024-08-28T15:44:26 Z ProtonDecay314 송신탑 (IOI22_towers) C++17
100 / 100
2181 ms 85708 KB
// AM + DG
#include "towers.h"
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;
typedef vector<pi> vpi;
typedef vector<pll> vpll;
typedef vector<vpi> vvpi;
typedef vector<vpll> vvpll;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef short int si;
typedef vector<si> vsi;
typedef vector<vsi> vvsi;
#define IOS ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
#define L(varll, mn, mx) for(ll varll = (mn); varll < (mx); varll++)
#define LR(varll, mx, mn) for(ll varll = (mx); varll > (mn); varll--)
#define LI(vari, mn, mx) for(int vari = (mn); vari < (mx); vari++)
#define LIR(vari, mx, mn) for(int vari = (mx); vari > (mn); vari--)
#define INPV(varvec) for(auto& varveci : (varvec)) cin >> varveci
#define fi first
#define se second
#define pb push_back
#define INF(type) numeric_limits<type>::max()
#define NINF(type) numeric_limits<type>::min()
#define TCASES int t; cin >> t; while(t--)

/*
DTree (DiffTree)

Computes the largest forward difference within a range

Formally, max l <= i <= j <= r of h[j] - h[i]
*/
struct DTreeState {
    int mn, mx, difff, diffb;

    DTreeState operator+(const DTreeState& o) const {
        if(mn == 0) return o;
        else if(o.mn == 0) return {mn, mx, difff, diffb};
        return {min(mn, o.mn), max(mx, o.mx), max(max(difff, o.difff), o.mx - mn), max(max(diffb, o.diffb), mx - o.mn)};
    }
};

class DTree {
    public:
        int l, r;
        DTree *lt, *rt;
        DTreeState v;

        DTree(int a_l, int a_r): l(a_l), r(a_r), lt(nullptr), rt(nullptr), v({0, 0, 0}) {}

        void combine() {
            v = lt->v + rt->v; // ! Careful! Addition is noncommutative!
        }

        void build(const vi& a) {
            if(l == r) {
                v = {a[l], a[l], 0, 0};

                return;
            }

            int m = (l + r) >> 1;

            lt = new DTree(l, m);

            rt = new DTree(m + 1, r);

            lt->build(a);
            rt->build(a);

            combine();
        }

        DTreeState qry(int ql, int qr) {
            if(ql > r || qr < l) return {0, 0, 0, 0};

            if(ql == l && qr == r) {
                return v;
            }

            int m = (l + r) >> 1;

            return lt->qry(ql, min(qr, m)) + rt->qry(max(ql, m + 1) , qr);
        }
};

/*
LTree (Lease Tree)

The lease tree will compute the maximum and minimum indices to be leased
if the value of delta is D

Notice that each node has a corresponding max delta and index

Now, what if we store the deltas in increasing order? (could be decreasing too)

Then, when the value of delta is D, that means that a suffix (or prefix) would
be the values in consideration

Well, now, what if we compute the min and max indices over a prefix?

So it reduces to binary search ^^

It reduces to two binary searches, actually, so Q log^2 N per query

Conceptually, a node would have a schema of...

type Node = {
    l, r: int
    lt, rt: Node*
    deltas: [delta, ind][]
    mins: int[]
    maxs: int[]
}
*/
class LTree {
    public:
        int l, r;
        LTree *lt, *rt;
        vpi deltas;
        vi mins;
        vi maxs;

        LTree(int a_l, int a_r): l(a_l), r(a_r), deltas(), mins(), maxs() {}
        
        void combine() {
            int lds = lt->deltas.size(), rds = rt->deltas.size();

            int ldp = 0, rdp = 0;

            while(ldp < lds && rdp < rds) {
                if(lt->deltas[ldp].fi > rt->deltas[rdp].fi) {
                    deltas.pb(lt->deltas[ldp]);
                    ldp++;
                } else {
                    deltas.pb(rt->deltas[rdp]);
                    rdp++;
                }
            }

            while(ldp < lds) {
                deltas.pb(lt->deltas[ldp]);
                ldp++;
            }

            while(rdp < rds) {
                deltas.pb(rt->deltas[rdp]);
                rdp++;
            }

            int ds = deltas.size();

            mins.reserve(ds);
            maxs.reserve(ds);

            mins.pb(INF(int));
            maxs.pb(NINF(int));

            for(int i = 0; i < ds; i++) {
                mins.pb(min(mins.back(), deltas[i].se));
                maxs.pb(max(maxs.back(), deltas[i].se));
            }
        }

        void build(const vi& d) {
            if(l == r) {
                deltas.pb({d[l], l});
                mins.pb(INF(int));
                mins.pb(l);
                maxs.pb(NINF(int));
                maxs.pb(l);
                return;
            }

            int m = (l + r) >> 1;

            lt = new LTree(l, m);
            rt = new LTree(m + 1, r);

            lt->build(d);
            rt->build(d);

            combine();
        }

        pi qry(int ql, int qr, int d) {
            if(ql > r || qr < l) return {INF(int), NINF(int)};

            if(ql == l && qr == r) {
                int ds = deltas.size();
                int li = -1, ri = ds;

                while(ri - li > 1) {
                    int m = (li + ri) >> 1;

                    if(deltas[m].fi >= d) li = m;
                    else ri = m;
                }

                return {mins[li + 1], maxs[li + 1]};
            }

            int m = (l + r) >> 1;

            auto [mn1, mx1] = lt->qry(ql, min(qr, m), d);
            auto [mn2, mx2] = rt->qry(max(m + 1, ql), qr, d);

            return {min(mn1, mn2), max(mx1, mx2)};
        }

        int qry_count(int ql, int qr, int d) {
            if(ql > r || qr < l) return 0;

            if(ql == l && qr == r) {
                int ds = deltas.size();
                int li = -1, ri = ds;

                while(ri - li > 1) {
                    int m = (li + ri) >> 1;

                    if(deltas[m].fi >= d) li = m;
                    else ri = m;
                }

                return li + 1;
            }

            int m = (l + r) >> 1;

            return lt->qry_count(ql, min(qr, m), d) + rt->qry_count(max(m + 1, ql), qr, d);
        }
};

int n;
vi h;

DTree* dtr;
LTree* ltr;
vi dvals;

void init(int N, vi H) {
    n = N;
    h = H;

    // Create DTree
    dtr = new DTree(0, n - 1);

    dtr->build(h);

    // Compute critical d-values
    for(int i = 0; i < n; i++) {
        int l1 = -1, r1 = i;

        while(r1 - l1 > 1) {
            int m = (l1 + r1) >> 1;

            if(dtr->qry(m, i).mn < h[i]) l1 = m;
            else r1 = m;
        }

        int l2 = i, r2 = n;

        while(r2 - l2 > 1) {
            int m = (l2 + r2) >> 1;

            if(dtr->qry(i, m).mn < h[i]) r2 = m;
            else l2 = m;
        }
        
        int min_h = INF(int);

        if(l1 != -1) {
            min_h = min(min_h, dtr->qry(l1, i).mx);
        }

        if(r2 != n) {
            min_h = min(min_h, dtr->qry(i, r2).mx);
        }

        dvals.pb(min_h - h[i]);
    }

    ltr = new LTree(0, n - 1);
    ltr->build(dvals);
}

int max_towers(int L, int R, int D) {
    auto [li, ri] = ltr->qry(L, R, D);
    // cout << "! " << li << " " << ri << endl;
    int ans = 0;

    if(li == INF(int)) {
        // Case 1 (wow, research follows me everywhere): no leased in the range
        // Check forward and backward largest diffs

        auto state = dtr->qry(L, R);

        if(state.diffb >= D) ans++;
        if(state.difff >= D) ans++;
    } else {
        // Case 2 (res reference???): there is at least one leased in the range
        ans = ltr->qry_count(L, R, D);

        if(dtr->qry(L, li - 1).difff >= D) ans++;
        if(dtr->qry(ri + 1, R).diffb >= D) ans++;
    }

    return max(ans, 1);
}

/*
Last frontier
kodoku na hoshitachi e sasageru uta wo
Last moment
hitori de saihate e tabidatsu uta wo
Last of all
majiwaru koto no nai sekai wo
ima kaeru kara saigo ni
kimi to boku wa deau
*/
# 결과 실행 시간 메모리 Grader output
1 Correct 954 ms 49392 KB Output is correct
2 Correct 1957 ms 85232 KB Output is correct
3 Correct 1871 ms 85188 KB Output is correct
4 Correct 1866 ms 85464 KB Output is correct
5 Correct 1859 ms 85460 KB Output is correct
6 Correct 1865 ms 85376 KB Output is correct
7 Correct 1819 ms 85468 KB Output is correct
8 Correct 1 ms 344 KB Output is correct
9 Correct 8 ms 1876 KB Output is correct
10 Correct 9 ms 1880 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 600 KB Output is correct
2 Correct 8 ms 1676 KB Output is correct
3 Correct 8 ms 1880 KB Output is correct
4 Correct 7 ms 1676 KB Output is correct
5 Correct 8 ms 1880 KB Output is correct
6 Correct 8 ms 1880 KB Output is correct
7 Correct 9 ms 1880 KB Output is correct
8 Correct 8 ms 1880 KB Output is correct
9 Correct 9 ms 1880 KB Output is correct
10 Correct 10 ms 1880 KB Output is correct
11 Correct 8 ms 1880 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 8 ms 1880 KB Output is correct
14 Correct 7 ms 1712 KB Output is correct
15 Correct 7 ms 1880 KB Output is correct
16 Correct 7 ms 1880 KB Output is correct
17 Correct 7 ms 1880 KB Output is correct
18 Correct 7 ms 1880 KB Output is correct
19 Correct 8 ms 1680 KB Output is correct
20 Correct 7 ms 1668 KB Output is correct
21 Correct 8 ms 1880 KB Output is correct
22 Correct 7 ms 1880 KB Output is correct
23 Correct 10 ms 1880 KB Output is correct
24 Correct 8 ms 1668 KB Output is correct
25 Correct 3 ms 856 KB Output is correct
26 Correct 9 ms 1880 KB Output is correct
27 Correct 10 ms 1696 KB Output is correct
28 Correct 8 ms 1880 KB Output is correct
29 Correct 7 ms 1880 KB Output is correct
30 Correct 8 ms 1880 KB Output is correct
31 Correct 8 ms 1880 KB Output is correct
32 Correct 8 ms 1684 KB Output is correct
33 Correct 7 ms 1880 KB Output is correct
34 Correct 7 ms 1880 KB Output is correct
35 Correct 7 ms 1880 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 600 KB Output is correct
2 Correct 8 ms 1676 KB Output is correct
3 Correct 8 ms 1880 KB Output is correct
4 Correct 7 ms 1676 KB Output is correct
5 Correct 8 ms 1880 KB Output is correct
6 Correct 8 ms 1880 KB Output is correct
7 Correct 9 ms 1880 KB Output is correct
8 Correct 8 ms 1880 KB Output is correct
9 Correct 9 ms 1880 KB Output is correct
10 Correct 10 ms 1880 KB Output is correct
11 Correct 8 ms 1880 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 8 ms 1880 KB Output is correct
14 Correct 7 ms 1712 KB Output is correct
15 Correct 7 ms 1880 KB Output is correct
16 Correct 7 ms 1880 KB Output is correct
17 Correct 7 ms 1880 KB Output is correct
18 Correct 7 ms 1880 KB Output is correct
19 Correct 8 ms 1680 KB Output is correct
20 Correct 7 ms 1668 KB Output is correct
21 Correct 8 ms 1880 KB Output is correct
22 Correct 7 ms 1880 KB Output is correct
23 Correct 10 ms 1880 KB Output is correct
24 Correct 8 ms 1668 KB Output is correct
25 Correct 3 ms 856 KB Output is correct
26 Correct 9 ms 1880 KB Output is correct
27 Correct 10 ms 1696 KB Output is correct
28 Correct 8 ms 1880 KB Output is correct
29 Correct 7 ms 1880 KB Output is correct
30 Correct 8 ms 1880 KB Output is correct
31 Correct 8 ms 1880 KB Output is correct
32 Correct 8 ms 1684 KB Output is correct
33 Correct 7 ms 1880 KB Output is correct
34 Correct 7 ms 1880 KB Output is correct
35 Correct 7 ms 1880 KB Output is correct
36 Correct 476 ms 53748 KB Output is correct
37 Correct 772 ms 85188 KB Output is correct
38 Correct 779 ms 85188 KB Output is correct
39 Correct 821 ms 85196 KB Output is correct
40 Correct 803 ms 85416 KB Output is correct
41 Correct 837 ms 85188 KB Output is correct
42 Correct 843 ms 85188 KB Output is correct
43 Correct 782 ms 85188 KB Output is correct
44 Correct 792 ms 85376 KB Output is correct
45 Correct 807 ms 85408 KB Output is correct
46 Correct 809 ms 85292 KB Output is correct
47 Correct 922 ms 85296 KB Output is correct
48 Correct 909 ms 85188 KB Output is correct
49 Correct 838 ms 85368 KB Output is correct
50 Correct 793 ms 85192 KB Output is correct
51 Correct 825 ms 85408 KB Output is correct
52 Correct 789 ms 85188 KB Output is correct
53 Correct 832 ms 85408 KB Output is correct
54 Correct 776 ms 85452 KB Output is correct
55 Correct 836 ms 85216 KB Output is correct
56 Correct 830 ms 85248 KB Output is correct
57 Correct 770 ms 82632 KB Output is correct
58 Correct 794 ms 85188 KB Output is correct
59 Correct 774 ms 85292 KB Output is correct
60 Correct 776 ms 85188 KB Output is correct
61 Correct 777 ms 85212 KB Output is correct
62 Correct 772 ms 85240 KB Output is correct
63 Correct 798 ms 85440 KB Output is correct
64 Correct 849 ms 85256 KB Output is correct
65 Correct 840 ms 85188 KB Output is correct
66 Correct 814 ms 85188 KB Output is correct
67 Correct 795 ms 85192 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1717 ms 84680 KB Output is correct
2 Correct 1985 ms 85188 KB Output is correct
3 Correct 1950 ms 85372 KB Output is correct
4 Correct 1871 ms 85188 KB Output is correct
5 Correct 1959 ms 85488 KB Output is correct
6 Correct 1871 ms 85204 KB Output is correct
7 Correct 1976 ms 85384 KB Output is correct
8 Correct 1820 ms 85188 KB Output is correct
9 Correct 1884 ms 85344 KB Output is correct
10 Correct 1980 ms 85268 KB Output is correct
11 Correct 1881 ms 85232 KB Output is correct
12 Correct 1900 ms 85188 KB Output is correct
13 Correct 1899 ms 85372 KB Output is correct
14 Correct 1 ms 344 KB Output is correct
15 Correct 8 ms 1880 KB Output is correct
16 Correct 9 ms 1880 KB Output is correct
17 Correct 825 ms 85340 KB Output is correct
18 Correct 821 ms 85328 KB Output is correct
19 Correct 796 ms 85408 KB Output is correct
20 Correct 793 ms 85260 KB Output is correct
21 Correct 811 ms 85392 KB Output is correct
22 Correct 779 ms 85188 KB Output is correct
23 Correct 772 ms 85348 KB Output is correct
24 Correct 788 ms 85188 KB Output is correct
25 Correct 860 ms 85188 KB Output is correct
26 Correct 802 ms 85404 KB Output is correct
27 Correct 8 ms 1880 KB Output is correct
28 Correct 8 ms 1880 KB Output is correct
29 Correct 8 ms 1880 KB Output is correct
30 Correct 7 ms 1668 KB Output is correct
31 Correct 8 ms 1880 KB Output is correct
32 Correct 7 ms 1880 KB Output is correct
33 Correct 8 ms 1880 KB Output is correct
34 Correct 8 ms 1880 KB Output is correct
35 Correct 8 ms 1880 KB Output is correct
36 Correct 8 ms 1672 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 376 ms 20064 KB Output is correct
2 Correct 1488 ms 85708 KB Output is correct
3 Correct 1500 ms 85188 KB Output is correct
4 Correct 1509 ms 85208 KB Output is correct
5 Correct 1542 ms 85364 KB Output is correct
6 Correct 1513 ms 85388 KB Output is correct
7 Correct 1528 ms 85192 KB Output is correct
8 Correct 1509 ms 85396 KB Output is correct
9 Correct 1523 ms 85380 KB Output is correct
10 Correct 1518 ms 85188 KB Output is correct
11 Correct 1508 ms 85188 KB Output is correct
12 Correct 796 ms 85188 KB Output is correct
13 Correct 788 ms 85400 KB Output is correct
14 Correct 803 ms 85400 KB Output is correct
15 Correct 762 ms 85188 KB Output is correct
16 Correct 828 ms 85188 KB Output is correct
17 Correct 792 ms 82572 KB Output is correct
18 Correct 826 ms 85368 KB Output is correct
19 Correct 821 ms 85188 KB Output is correct
20 Correct 846 ms 85384 KB Output is correct
21 Correct 826 ms 85284 KB Output is correct
22 Correct 899 ms 85284 KB Output is correct
23 Correct 830 ms 85376 KB Output is correct
24 Correct 875 ms 85260 KB Output is correct
25 Correct 834 ms 85244 KB Output is correct
26 Correct 972 ms 85324 KB Output is correct
27 Correct 806 ms 85192 KB Output is correct
28 Correct 8 ms 1880 KB Output is correct
29 Correct 8 ms 1672 KB Output is correct
30 Correct 13 ms 1880 KB Output is correct
31 Correct 10 ms 1880 KB Output is correct
32 Correct 12 ms 1880 KB Output is correct
33 Correct 6 ms 1016 KB Output is correct
34 Correct 8 ms 1876 KB Output is correct
35 Correct 13 ms 2132 KB Output is correct
36 Correct 13 ms 1880 KB Output is correct
37 Correct 7 ms 1880 KB Output is correct
38 Correct 7 ms 1680 KB Output is correct
39 Correct 8 ms 1880 KB Output is correct
40 Correct 10 ms 1676 KB Output is correct
41 Correct 13 ms 1880 KB Output is correct
42 Correct 12 ms 1880 KB Output is correct
43 Correct 7 ms 1672 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 600 KB Output is correct
2 Correct 8 ms 1676 KB Output is correct
3 Correct 8 ms 1880 KB Output is correct
4 Correct 7 ms 1676 KB Output is correct
5 Correct 8 ms 1880 KB Output is correct
6 Correct 8 ms 1880 KB Output is correct
7 Correct 9 ms 1880 KB Output is correct
8 Correct 8 ms 1880 KB Output is correct
9 Correct 9 ms 1880 KB Output is correct
10 Correct 10 ms 1880 KB Output is correct
11 Correct 8 ms 1880 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 8 ms 1880 KB Output is correct
14 Correct 7 ms 1712 KB Output is correct
15 Correct 7 ms 1880 KB Output is correct
16 Correct 7 ms 1880 KB Output is correct
17 Correct 7 ms 1880 KB Output is correct
18 Correct 7 ms 1880 KB Output is correct
19 Correct 8 ms 1680 KB Output is correct
20 Correct 7 ms 1668 KB Output is correct
21 Correct 8 ms 1880 KB Output is correct
22 Correct 7 ms 1880 KB Output is correct
23 Correct 10 ms 1880 KB Output is correct
24 Correct 8 ms 1668 KB Output is correct
25 Correct 3 ms 856 KB Output is correct
26 Correct 9 ms 1880 KB Output is correct
27 Correct 10 ms 1696 KB Output is correct
28 Correct 8 ms 1880 KB Output is correct
29 Correct 7 ms 1880 KB Output is correct
30 Correct 8 ms 1880 KB Output is correct
31 Correct 8 ms 1880 KB Output is correct
32 Correct 8 ms 1684 KB Output is correct
33 Correct 7 ms 1880 KB Output is correct
34 Correct 7 ms 1880 KB Output is correct
35 Correct 7 ms 1880 KB Output is correct
36 Correct 476 ms 53748 KB Output is correct
37 Correct 772 ms 85188 KB Output is correct
38 Correct 779 ms 85188 KB Output is correct
39 Correct 821 ms 85196 KB Output is correct
40 Correct 803 ms 85416 KB Output is correct
41 Correct 837 ms 85188 KB Output is correct
42 Correct 843 ms 85188 KB Output is correct
43 Correct 782 ms 85188 KB Output is correct
44 Correct 792 ms 85376 KB Output is correct
45 Correct 807 ms 85408 KB Output is correct
46 Correct 809 ms 85292 KB Output is correct
47 Correct 922 ms 85296 KB Output is correct
48 Correct 909 ms 85188 KB Output is correct
49 Correct 838 ms 85368 KB Output is correct
50 Correct 793 ms 85192 KB Output is correct
51 Correct 825 ms 85408 KB Output is correct
52 Correct 789 ms 85188 KB Output is correct
53 Correct 832 ms 85408 KB Output is correct
54 Correct 776 ms 85452 KB Output is correct
55 Correct 836 ms 85216 KB Output is correct
56 Correct 830 ms 85248 KB Output is correct
57 Correct 770 ms 82632 KB Output is correct
58 Correct 794 ms 85188 KB Output is correct
59 Correct 774 ms 85292 KB Output is correct
60 Correct 776 ms 85188 KB Output is correct
61 Correct 777 ms 85212 KB Output is correct
62 Correct 772 ms 85240 KB Output is correct
63 Correct 798 ms 85440 KB Output is correct
64 Correct 849 ms 85256 KB Output is correct
65 Correct 840 ms 85188 KB Output is correct
66 Correct 814 ms 85188 KB Output is correct
67 Correct 795 ms 85192 KB Output is correct
68 Correct 1717 ms 84680 KB Output is correct
69 Correct 1985 ms 85188 KB Output is correct
70 Correct 1950 ms 85372 KB Output is correct
71 Correct 1871 ms 85188 KB Output is correct
72 Correct 1959 ms 85488 KB Output is correct
73 Correct 1871 ms 85204 KB Output is correct
74 Correct 1976 ms 85384 KB Output is correct
75 Correct 1820 ms 85188 KB Output is correct
76 Correct 1884 ms 85344 KB Output is correct
77 Correct 1980 ms 85268 KB Output is correct
78 Correct 1881 ms 85232 KB Output is correct
79 Correct 1900 ms 85188 KB Output is correct
80 Correct 1899 ms 85372 KB Output is correct
81 Correct 1 ms 344 KB Output is correct
82 Correct 8 ms 1880 KB Output is correct
83 Correct 9 ms 1880 KB Output is correct
84 Correct 825 ms 85340 KB Output is correct
85 Correct 821 ms 85328 KB Output is correct
86 Correct 796 ms 85408 KB Output is correct
87 Correct 793 ms 85260 KB Output is correct
88 Correct 811 ms 85392 KB Output is correct
89 Correct 779 ms 85188 KB Output is correct
90 Correct 772 ms 85348 KB Output is correct
91 Correct 788 ms 85188 KB Output is correct
92 Correct 860 ms 85188 KB Output is correct
93 Correct 802 ms 85404 KB Output is correct
94 Correct 8 ms 1880 KB Output is correct
95 Correct 8 ms 1880 KB Output is correct
96 Correct 8 ms 1880 KB Output is correct
97 Correct 7 ms 1668 KB Output is correct
98 Correct 8 ms 1880 KB Output is correct
99 Correct 7 ms 1880 KB Output is correct
100 Correct 8 ms 1880 KB Output is correct
101 Correct 8 ms 1880 KB Output is correct
102 Correct 8 ms 1880 KB Output is correct
103 Correct 8 ms 1672 KB Output is correct
104 Correct 1745 ms 76228 KB Output is correct
105 Correct 2048 ms 85412 KB Output is correct
106 Correct 2181 ms 85188 KB Output is correct
107 Correct 2114 ms 85184 KB Output is correct
108 Correct 2082 ms 85376 KB Output is correct
109 Correct 1948 ms 85188 KB Output is correct
110 Correct 2090 ms 85376 KB Output is correct
111 Correct 2101 ms 85204 KB Output is correct
112 Correct 1995 ms 85192 KB Output is correct
113 Correct 2021 ms 85444 KB Output is correct
114 Correct 2041 ms 85240 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 954 ms 49392 KB Output is correct
2 Correct 1957 ms 85232 KB Output is correct
3 Correct 1871 ms 85188 KB Output is correct
4 Correct 1866 ms 85464 KB Output is correct
5 Correct 1859 ms 85460 KB Output is correct
6 Correct 1865 ms 85376 KB Output is correct
7 Correct 1819 ms 85468 KB Output is correct
8 Correct 1 ms 344 KB Output is correct
9 Correct 8 ms 1876 KB Output is correct
10 Correct 9 ms 1880 KB Output is correct
11 Correct 1 ms 600 KB Output is correct
12 Correct 8 ms 1676 KB Output is correct
13 Correct 8 ms 1880 KB Output is correct
14 Correct 7 ms 1676 KB Output is correct
15 Correct 8 ms 1880 KB Output is correct
16 Correct 8 ms 1880 KB Output is correct
17 Correct 9 ms 1880 KB Output is correct
18 Correct 8 ms 1880 KB Output is correct
19 Correct 9 ms 1880 KB Output is correct
20 Correct 10 ms 1880 KB Output is correct
21 Correct 8 ms 1880 KB Output is correct
22 Correct 0 ms 344 KB Output is correct
23 Correct 8 ms 1880 KB Output is correct
24 Correct 7 ms 1712 KB Output is correct
25 Correct 7 ms 1880 KB Output is correct
26 Correct 7 ms 1880 KB Output is correct
27 Correct 7 ms 1880 KB Output is correct
28 Correct 7 ms 1880 KB Output is correct
29 Correct 8 ms 1680 KB Output is correct
30 Correct 7 ms 1668 KB Output is correct
31 Correct 8 ms 1880 KB Output is correct
32 Correct 7 ms 1880 KB Output is correct
33 Correct 10 ms 1880 KB Output is correct
34 Correct 8 ms 1668 KB Output is correct
35 Correct 3 ms 856 KB Output is correct
36 Correct 9 ms 1880 KB Output is correct
37 Correct 10 ms 1696 KB Output is correct
38 Correct 8 ms 1880 KB Output is correct
39 Correct 7 ms 1880 KB Output is correct
40 Correct 8 ms 1880 KB Output is correct
41 Correct 8 ms 1880 KB Output is correct
42 Correct 8 ms 1684 KB Output is correct
43 Correct 7 ms 1880 KB Output is correct
44 Correct 7 ms 1880 KB Output is correct
45 Correct 7 ms 1880 KB Output is correct
46 Correct 476 ms 53748 KB Output is correct
47 Correct 772 ms 85188 KB Output is correct
48 Correct 779 ms 85188 KB Output is correct
49 Correct 821 ms 85196 KB Output is correct
50 Correct 803 ms 85416 KB Output is correct
51 Correct 837 ms 85188 KB Output is correct
52 Correct 843 ms 85188 KB Output is correct
53 Correct 782 ms 85188 KB Output is correct
54 Correct 792 ms 85376 KB Output is correct
55 Correct 807 ms 85408 KB Output is correct
56 Correct 809 ms 85292 KB Output is correct
57 Correct 922 ms 85296 KB Output is correct
58 Correct 909 ms 85188 KB Output is correct
59 Correct 838 ms 85368 KB Output is correct
60 Correct 793 ms 85192 KB Output is correct
61 Correct 825 ms 85408 KB Output is correct
62 Correct 789 ms 85188 KB Output is correct
63 Correct 832 ms 85408 KB Output is correct
64 Correct 776 ms 85452 KB Output is correct
65 Correct 836 ms 85216 KB Output is correct
66 Correct 830 ms 85248 KB Output is correct
67 Correct 770 ms 82632 KB Output is correct
68 Correct 794 ms 85188 KB Output is correct
69 Correct 774 ms 85292 KB Output is correct
70 Correct 776 ms 85188 KB Output is correct
71 Correct 777 ms 85212 KB Output is correct
72 Correct 772 ms 85240 KB Output is correct
73 Correct 798 ms 85440 KB Output is correct
74 Correct 849 ms 85256 KB Output is correct
75 Correct 840 ms 85188 KB Output is correct
76 Correct 814 ms 85188 KB Output is correct
77 Correct 795 ms 85192 KB Output is correct
78 Correct 1717 ms 84680 KB Output is correct
79 Correct 1985 ms 85188 KB Output is correct
80 Correct 1950 ms 85372 KB Output is correct
81 Correct 1871 ms 85188 KB Output is correct
82 Correct 1959 ms 85488 KB Output is correct
83 Correct 1871 ms 85204 KB Output is correct
84 Correct 1976 ms 85384 KB Output is correct
85 Correct 1820 ms 85188 KB Output is correct
86 Correct 1884 ms 85344 KB Output is correct
87 Correct 1980 ms 85268 KB Output is correct
88 Correct 1881 ms 85232 KB Output is correct
89 Correct 1900 ms 85188 KB Output is correct
90 Correct 1899 ms 85372 KB Output is correct
91 Correct 1 ms 344 KB Output is correct
92 Correct 8 ms 1880 KB Output is correct
93 Correct 9 ms 1880 KB Output is correct
94 Correct 825 ms 85340 KB Output is correct
95 Correct 821 ms 85328 KB Output is correct
96 Correct 796 ms 85408 KB Output is correct
97 Correct 793 ms 85260 KB Output is correct
98 Correct 811 ms 85392 KB Output is correct
99 Correct 779 ms 85188 KB Output is correct
100 Correct 772 ms 85348 KB Output is correct
101 Correct 788 ms 85188 KB Output is correct
102 Correct 860 ms 85188 KB Output is correct
103 Correct 802 ms 85404 KB Output is correct
104 Correct 8 ms 1880 KB Output is correct
105 Correct 8 ms 1880 KB Output is correct
106 Correct 8 ms 1880 KB Output is correct
107 Correct 7 ms 1668 KB Output is correct
108 Correct 8 ms 1880 KB Output is correct
109 Correct 7 ms 1880 KB Output is correct
110 Correct 8 ms 1880 KB Output is correct
111 Correct 8 ms 1880 KB Output is correct
112 Correct 8 ms 1880 KB Output is correct
113 Correct 8 ms 1672 KB Output is correct
114 Correct 376 ms 20064 KB Output is correct
115 Correct 1488 ms 85708 KB Output is correct
116 Correct 1500 ms 85188 KB Output is correct
117 Correct 1509 ms 85208 KB Output is correct
118 Correct 1542 ms 85364 KB Output is correct
119 Correct 1513 ms 85388 KB Output is correct
120 Correct 1528 ms 85192 KB Output is correct
121 Correct 1509 ms 85396 KB Output is correct
122 Correct 1523 ms 85380 KB Output is correct
123 Correct 1518 ms 85188 KB Output is correct
124 Correct 1508 ms 85188 KB Output is correct
125 Correct 796 ms 85188 KB Output is correct
126 Correct 788 ms 85400 KB Output is correct
127 Correct 803 ms 85400 KB Output is correct
128 Correct 762 ms 85188 KB Output is correct
129 Correct 828 ms 85188 KB Output is correct
130 Correct 792 ms 82572 KB Output is correct
131 Correct 826 ms 85368 KB Output is correct
132 Correct 821 ms 85188 KB Output is correct
133 Correct 846 ms 85384 KB Output is correct
134 Correct 826 ms 85284 KB Output is correct
135 Correct 899 ms 85284 KB Output is correct
136 Correct 830 ms 85376 KB Output is correct
137 Correct 875 ms 85260 KB Output is correct
138 Correct 834 ms 85244 KB Output is correct
139 Correct 972 ms 85324 KB Output is correct
140 Correct 806 ms 85192 KB Output is correct
141 Correct 8 ms 1880 KB Output is correct
142 Correct 8 ms 1672 KB Output is correct
143 Correct 13 ms 1880 KB Output is correct
144 Correct 10 ms 1880 KB Output is correct
145 Correct 12 ms 1880 KB Output is correct
146 Correct 6 ms 1016 KB Output is correct
147 Correct 8 ms 1876 KB Output is correct
148 Correct 13 ms 2132 KB Output is correct
149 Correct 13 ms 1880 KB Output is correct
150 Correct 7 ms 1880 KB Output is correct
151 Correct 7 ms 1680 KB Output is correct
152 Correct 8 ms 1880 KB Output is correct
153 Correct 10 ms 1676 KB Output is correct
154 Correct 13 ms 1880 KB Output is correct
155 Correct 12 ms 1880 KB Output is correct
156 Correct 7 ms 1672 KB Output is correct
157 Correct 1745 ms 76228 KB Output is correct
158 Correct 2048 ms 85412 KB Output is correct
159 Correct 2181 ms 85188 KB Output is correct
160 Correct 2114 ms 85184 KB Output is correct
161 Correct 2082 ms 85376 KB Output is correct
162 Correct 1948 ms 85188 KB Output is correct
163 Correct 2090 ms 85376 KB Output is correct
164 Correct 2101 ms 85204 KB Output is correct
165 Correct 1995 ms 85192 KB Output is correct
166 Correct 2021 ms 85444 KB Output is correct
167 Correct 2041 ms 85240 KB Output is correct
168 Correct 1 ms 344 KB Output is correct
169 Correct 960 ms 29960 KB Output is correct
170 Correct 2171 ms 85424 KB Output is correct
171 Correct 1987 ms 85220 KB Output is correct
172 Correct 1981 ms 85188 KB Output is correct
173 Correct 2037 ms 85188 KB Output is correct
174 Correct 2021 ms 85344 KB Output is correct
175 Correct 1997 ms 85396 KB Output is correct
176 Correct 1813 ms 85376 KB Output is correct
177 Correct 1842 ms 85344 KB Output is correct
178 Correct 1904 ms 85308 KB Output is correct
179 Correct 1924 ms 85484 KB Output is correct