Submission #635285

# Submission time Handle Problem Language Result Execution time Memory
635285 2022-08-25T21:20:19 Z tutis Radio Towers (IOI22_towers) C++17
100 / 100
1921 ms 122432 KB
#include "towers.h"

#include <bits/stdc++.h>
using namespace std;
vector<int>H;
struct ST
{
    int l, r;
    ST *left, *right;
    int mn;
    ST() {}
    vector<pair<int, int>>V;
    vector<pair<int, int>>W;
    vector<pair<int, int>>V_;
    vector<pair<int, int>>W_;
    ST(int l, int r): l(l), r(r)
    {
        if (l < r)
        {
            left = new ST(l, (l + r) / 2);
            right = new ST((l + r) / 2 + 1, r);
            mn = min(left->mn, right->mn);
        }
        else
        {
            left = right = NULL;
            mn = H[l];
        }
        {
            for (int i = l; i <= r; i++)
            {
                if (W.empty() || H[i] > W.back().first)
                    W.push_back({H[i], i});
            }
            int mm = 1.1e9;
            for (int i = l + 1; i <= r; i++)
            {
                mm = min(mm, H[i - 1]);
                if (V.empty() || H[i] - mm > V.back().first)
                    V.push_back({H[i] - mm, i});
            }
        }
        {
            for (int i = r; i >= l; i--)
            {
                if (W_.empty() || H[i] > W_.back().first)
                    W_.push_back({H[i], i});
            }
            int mm = 1.1e9;
            for (int i = r - 1; i >= l; i--)
            {
                mm = min(mm, H[i + 1]);
                if (V_.empty() || H[i] - mm > V_.back().first)
                    V_.push_back({H[i] - mm, i});
            }
        }
    }
    int get(int x, int y)
    {
        if (x <= l && r <= y)
            return mn;
        if (r < x || y < l)
            return 1.1e9;
        return min(left->get(x, y), right->get(x, y));
    }
    pair<int, int> get1(int L, int D, int mnl = 1.1e9)
    {
        if (L <= l)
        {
            int rr = -1;
            if (!V.empty() && V.back().first >= D)
                rr = lower_bound(V.begin(), V.end(), make_pair(D, -1))->second;
            //W-mn>=D
            //W>=D+mn
            if (!W.empty() && W.back().first >= D + mnl) {
                auto it = lower_bound(W.begin(), W.end(), make_pair(D + mnl, -1));
                int r1 = it->second;
                if (rr == -1)
                    rr = r1;
                else
                    rr = min(rr, r1);
            }
            return {rr, mn};
        }
        if (r < L)
            return { -1, 1.1e9};
        pair<int, int> i = left->get1(L, D, mnl);
        if (i.first != -1)
            return i;
        pair<int, int> j = right->get1(L, D, min(i.second, mnl));
        j.second = min(j.second, i.second);
        if (i.first != -1)
            j.first = i.first;
        return j;
    }
    pair<int, int> get2(int R, int D, int mnl = 1.1e9)
    {
        if (R >= r)
        {
            int rr = -1;
            if (!V_.empty() && V_.back().first >= D)
                rr = lower_bound(V_.begin(), V_.end(), make_pair(D, -1))->second;
            //W-mn>=D
            //W>=D+mn
            if (!W_.empty() && W_.back().first >= D + mnl) {
                auto it = lower_bound(W_.begin(), W_.end(), make_pair(D + mnl, -1));
                int r1 = it->second;
                if (rr == -1)
                    rr = r1;
                else
                    rr = max(rr, r1);
            }
            return {rr, mn};
        }
        if (l > R)
            return { -1, 1.1e9};
        pair<int, int> i = right->get2(R, D, mnl);
        if (i.first != -1)
            return i;
        pair<int, int> j = left->get2(R, D, min(i.second, mnl));
        j.second = min(j.second, i.second);
        if (i.first != -1)
            j.first = i.first;
        return j;
    }
} medis;
vector<vector<pair<int, int>>>Fl, Fr;
int N;
vector<int>prv;
vector<int>nxt;
void init(int N_, vector<int> H_) {
    N = N_;
    H = H_;
    prv = vector<int>(N, -1);
    nxt = vector<int>(N, N + 1);
    {
        vector<int>A;
        for (int i = 0; i < N; i++)
        {
            while (!A.empty() && H[A.back()] <= H[i])
                A.pop_back();
            if (!A.empty())
                prv[i] = A.back();
            A.push_back(i);
        }
        A.clear();
        for (int i = N - 1; i >= 0; i--)
        {
            while (!A.empty() && H[A.back()] <= H[i])
                A.pop_back();
            if (!A.empty())
                nxt[i] = A.back();
            A.push_back(i);
        }
    }
    vector<int> p(N);
    iota(p.begin(), p.end(), 0);
    sort(p.begin(), p.end(), [&](int a, int b) {return H[a] > H[b];});
    set<int>X;
    medis = ST(0, N - 1);
    auto get = [&](int l, int r)
    {
        if (l + 1 >= r)
            return -1;
        int h = medis.get(l + 1, r - 1);
        return max(0, min(H[l] - h, H[r] - h));
    };
    map<int, pair<vector<pair<int, int>>, vector<pair<int, int>>>>LR;
    auto add = [&](int l, int r, int d, int w)
    {
        LR[d].second.push_back({r, w});
        LR[d].first.push_back({l, w});
    };
    for (int i : p)
    {
        int r = -1, l = -1;
        auto it = X.lower_bound(i);
        if (it != X.end())
        {
            r = *it;
        }
        if (it != X.begin())
        {
            it--;
            l = *it;
        }
        X.insert(i);
        if (l == -1 || r == -1)
        {
            if (r != -1 && i + 1 < r)
                add(i, r, get(i, r), 1);
            if (l != -1 && l + 1 < i)
                add(l, i, get(l, i), 1);
        }
        else
        {
            int d = get(l, r);
            int d1 = get(i, r);
            int d2 = get(l, i);
            if (d1 >= 0 || d2 >= 0)
            {
                add(i, r, d1, 1);
                add(l, i, d2, 1);
                assert(max(d1, d2) <= d);
                add(l, r, max(d1, d2), -1);
            }
        }
    }
    Fl = vector<vector<pair<int, int>>>(N);
    Fr = vector<vector<pair<int, int>>>(N);
    for (const auto &dd : LR)
    {
        int d = dd.first;
        for (pair<int, int>lw : dd.second.first)
            for (int i = lw.first; i < N; i |= i + 1)
            {
                if (!Fl[i].empty() && Fl[i].back().first == d)
                    Fl[i].back().second += lw.second;
                else
                    Fl[i].push_back({d, lw.second});
            }
        for (pair<int, int>rw : dd.second.second)
            for (int i = rw.first; i < N; i |= i + 1)
            {
                if (!Fr[i].empty() && Fr[i].back().first == d)
                    Fr[i].back().second += rw.second;
                else
                    Fr[i].push_back({d, rw.second});
            }
    }
    for (int i = 0; i < N; i++)
    {
        for (int j = 1; j < (int)Fl[i].size(); j++)
            Fl[i][j].second += Fl[i][j - 1].second;
        for (int j = 1; j < (int)Fr[i].size(); j++)
            Fr[i][j].second += Fr[i][j - 1].second;
    }
}
int get(int l, int r, int d)
{
    int ret = 0;
    int i = r;
    while (i >= 0)
    {
        if (!Fr[i].empty())
        {
            auto it = lower_bound(Fr[i].begin(), Fr[i].end(), make_pair(d, (int) - 1e9));
            ret += Fr[i].back().second;
            if (it != Fr[i].begin())
            {
                it--;
                ret -= it->second;
            }
        }
        i = (i & (i + 1)) - 1;
    }
    i = l - 1;
    while (i >= 0) {
        if (!Fl[i].empty())
        {
            auto it = lower_bound(Fl[i].begin(), Fl[i].end(), make_pair(d, (int) - 1e9));
            ret -= Fl[i].back().second;
            if (it != Fl[i].begin())
            {
                it--;
                ret += it->second;
            }
        }
        i = (i & (i + 1)) - 1;
    }
    return ret;
}
int max_towers(int L, int R, int D) {
    int xx = medis.get1(L, D).first;
    int yy = medis.get2(R, D).first;
    if (xx != -1 && yy != -1 && xx <= yy)
        return 2 + get(xx, yy, D);
    return 1;
}
# Verdict Execution time Memory Grader output
1 Correct 545 ms 49748 KB Output is correct
2 Correct 1346 ms 87488 KB Output is correct
3 Correct 1239 ms 87592 KB Output is correct
4 Correct 1181 ms 87280 KB Output is correct
5 Correct 1230 ms 87448 KB Output is correct
6 Correct 1056 ms 87364 KB Output is correct
7 Correct 1129 ms 87312 KB Output is correct
8 Correct 0 ms 208 KB Output is correct
9 Correct 2 ms 1744 KB Output is correct
10 Correct 2 ms 1744 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 592 KB Output is correct
2 Correct 6 ms 2128 KB Output is correct
3 Correct 6 ms 2184 KB Output is correct
4 Correct 5 ms 2000 KB Output is correct
5 Correct 5 ms 2000 KB Output is correct
6 Correct 5 ms 2000 KB Output is correct
7 Correct 5 ms 2000 KB Output is correct
8 Correct 2 ms 1744 KB Output is correct
9 Correct 2 ms 1720 KB Output is correct
10 Correct 4 ms 2068 KB Output is correct
11 Correct 4 ms 2356 KB Output is correct
12 Correct 0 ms 208 KB Output is correct
13 Correct 3 ms 1744 KB Output is correct
14 Correct 2 ms 1744 KB Output is correct
15 Correct 5 ms 2128 KB Output is correct
16 Correct 5 ms 2000 KB Output is correct
17 Correct 5 ms 2128 KB Output is correct
18 Correct 3 ms 1744 KB Output is correct
19 Correct 3 ms 2000 KB Output is correct
20 Correct 5 ms 2152 KB Output is correct
21 Correct 5 ms 2000 KB Output is correct
22 Correct 5 ms 2000 KB Output is correct
23 Correct 3 ms 1744 KB Output is correct
24 Correct 3 ms 1872 KB Output is correct
25 Correct 4 ms 1104 KB Output is correct
26 Correct 5 ms 2128 KB Output is correct
27 Correct 5 ms 2120 KB Output is correct
28 Correct 5 ms 2000 KB Output is correct
29 Correct 5 ms 2000 KB Output is correct
30 Correct 5 ms 2000 KB Output is correct
31 Correct 5 ms 2008 KB Output is correct
32 Correct 2 ms 1744 KB Output is correct
33 Correct 3 ms 1744 KB Output is correct
34 Correct 3 ms 1872 KB Output is correct
35 Correct 3 ms 2000 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 592 KB Output is correct
2 Correct 6 ms 2128 KB Output is correct
3 Correct 6 ms 2184 KB Output is correct
4 Correct 5 ms 2000 KB Output is correct
5 Correct 5 ms 2000 KB Output is correct
6 Correct 5 ms 2000 KB Output is correct
7 Correct 5 ms 2000 KB Output is correct
8 Correct 2 ms 1744 KB Output is correct
9 Correct 2 ms 1720 KB Output is correct
10 Correct 4 ms 2068 KB Output is correct
11 Correct 4 ms 2356 KB Output is correct
12 Correct 0 ms 208 KB Output is correct
13 Correct 3 ms 1744 KB Output is correct
14 Correct 2 ms 1744 KB Output is correct
15 Correct 5 ms 2128 KB Output is correct
16 Correct 5 ms 2000 KB Output is correct
17 Correct 5 ms 2128 KB Output is correct
18 Correct 3 ms 1744 KB Output is correct
19 Correct 3 ms 2000 KB Output is correct
20 Correct 5 ms 2152 KB Output is correct
21 Correct 5 ms 2000 KB Output is correct
22 Correct 5 ms 2000 KB Output is correct
23 Correct 3 ms 1744 KB Output is correct
24 Correct 3 ms 1872 KB Output is correct
25 Correct 4 ms 1104 KB Output is correct
26 Correct 5 ms 2128 KB Output is correct
27 Correct 5 ms 2120 KB Output is correct
28 Correct 5 ms 2000 KB Output is correct
29 Correct 5 ms 2000 KB Output is correct
30 Correct 5 ms 2000 KB Output is correct
31 Correct 5 ms 2008 KB Output is correct
32 Correct 2 ms 1744 KB Output is correct
33 Correct 3 ms 1744 KB Output is correct
34 Correct 3 ms 1872 KB Output is correct
35 Correct 3 ms 2000 KB Output is correct
36 Correct 347 ms 67076 KB Output is correct
37 Correct 548 ms 103524 KB Output is correct
38 Correct 569 ms 104076 KB Output is correct
39 Correct 501 ms 98524 KB Output is correct
40 Correct 497 ms 98812 KB Output is correct
41 Correct 502 ms 98608 KB Output is correct
42 Correct 488 ms 97968 KB Output is correct
43 Correct 136 ms 87220 KB Output is correct
44 Correct 137 ms 87284 KB Output is correct
45 Correct 233 ms 107264 KB Output is correct
46 Correct 212 ms 103828 KB Output is correct
47 Correct 561 ms 104140 KB Output is correct
48 Correct 507 ms 97780 KB Output is correct
49 Correct 510 ms 97892 KB Output is correct
50 Correct 139 ms 87264 KB Output is correct
51 Correct 138 ms 88124 KB Output is correct
52 Correct 587 ms 104008 KB Output is correct
53 Correct 511 ms 97972 KB Output is correct
54 Correct 509 ms 97748 KB Output is correct
55 Correct 153 ms 87604 KB Output is correct
56 Correct 253 ms 110708 KB Output is correct
57 Correct 551 ms 100080 KB Output is correct
58 Correct 579 ms 103960 KB Output is correct
59 Correct 581 ms 103792 KB Output is correct
60 Correct 531 ms 98200 KB Output is correct
61 Correct 496 ms 98288 KB Output is correct
62 Correct 497 ms 98060 KB Output is correct
63 Correct 530 ms 97536 KB Output is correct
64 Correct 144 ms 87224 KB Output is correct
65 Correct 138 ms 87340 KB Output is correct
66 Correct 270 ms 113996 KB Output is correct
67 Correct 150 ms 89176 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1487 ms 103564 KB Output is correct
2 Correct 1651 ms 104276 KB Output is correct
3 Correct 1775 ms 103452 KB Output is correct
4 Correct 1603 ms 97972 KB Output is correct
5 Correct 1581 ms 97984 KB Output is correct
6 Correct 1541 ms 98480 KB Output is correct
7 Correct 1562 ms 98152 KB Output is correct
8 Correct 1143 ms 87272 KB Output is correct
9 Correct 1125 ms 87276 KB Output is correct
10 Correct 1258 ms 99456 KB Output is correct
11 Correct 1220 ms 108768 KB Output is correct
12 Correct 1111 ms 87460 KB Output is correct
13 Correct 1102 ms 87312 KB Output is correct
14 Correct 0 ms 208 KB Output is correct
15 Correct 3 ms 1744 KB Output is correct
16 Correct 3 ms 1744 KB Output is correct
17 Correct 561 ms 104084 KB Output is correct
18 Correct 493 ms 97916 KB Output is correct
19 Correct 507 ms 97808 KB Output is correct
20 Correct 139 ms 87224 KB Output is correct
21 Correct 148 ms 88104 KB Output is correct
22 Correct 592 ms 104172 KB Output is correct
23 Correct 503 ms 97912 KB Output is correct
24 Correct 500 ms 97816 KB Output is correct
25 Correct 140 ms 87380 KB Output is correct
26 Correct 257 ms 110692 KB Output is correct
27 Correct 5 ms 2128 KB Output is correct
28 Correct 5 ms 2000 KB Output is correct
29 Correct 5 ms 2048 KB Output is correct
30 Correct 2 ms 1744 KB Output is correct
31 Correct 3 ms 2000 KB Output is correct
32 Correct 5 ms 2128 KB Output is correct
33 Correct 5 ms 2000 KB Output is correct
34 Correct 5 ms 2008 KB Output is correct
35 Correct 3 ms 1744 KB Output is correct
36 Correct 3 ms 1872 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 390 ms 24472 KB Output is correct
2 Correct 1434 ms 104852 KB Output is correct
3 Correct 1250 ms 103608 KB Output is correct
4 Correct 1295 ms 98024 KB Output is correct
5 Correct 1209 ms 97680 KB Output is correct
6 Correct 1294 ms 97900 KB Output is correct
7 Correct 1420 ms 98152 KB Output is correct
8 Correct 1048 ms 87308 KB Output is correct
9 Correct 802 ms 87220 KB Output is correct
10 Correct 1090 ms 112804 KB Output is correct
11 Correct 1097 ms 118412 KB Output is correct
12 Correct 564 ms 104084 KB Output is correct
13 Correct 503 ms 97688 KB Output is correct
14 Correct 494 ms 97712 KB Output is correct
15 Correct 138 ms 87360 KB Output is correct
16 Correct 255 ms 110672 KB Output is correct
17 Correct 536 ms 99736 KB Output is correct
18 Correct 560 ms 103736 KB Output is correct
19 Correct 567 ms 103768 KB Output is correct
20 Correct 493 ms 98200 KB Output is correct
21 Correct 492 ms 98236 KB Output is correct
22 Correct 499 ms 98168 KB Output is correct
23 Correct 502 ms 97584 KB Output is correct
24 Correct 138 ms 87228 KB Output is correct
25 Correct 141 ms 87384 KB Output is correct
26 Correct 263 ms 114108 KB Output is correct
27 Correct 144 ms 89160 KB Output is correct
28 Correct 5 ms 2128 KB Output is correct
29 Correct 5 ms 2000 KB Output is correct
30 Correct 5 ms 2000 KB Output is correct
31 Correct 2 ms 1744 KB Output is correct
32 Correct 3 ms 1872 KB Output is correct
33 Correct 3 ms 1160 KB Output is correct
34 Correct 5 ms 2228 KB Output is correct
35 Correct 5 ms 2148 KB Output is correct
36 Correct 4 ms 2000 KB Output is correct
37 Correct 5 ms 2000 KB Output is correct
38 Correct 5 ms 2124 KB Output is correct
39 Correct 5 ms 2000 KB Output is correct
40 Correct 2 ms 1644 KB Output is correct
41 Correct 2 ms 1744 KB Output is correct
42 Correct 3 ms 1872 KB Output is correct
43 Correct 4 ms 2004 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 592 KB Output is correct
2 Correct 6 ms 2128 KB Output is correct
3 Correct 6 ms 2184 KB Output is correct
4 Correct 5 ms 2000 KB Output is correct
5 Correct 5 ms 2000 KB Output is correct
6 Correct 5 ms 2000 KB Output is correct
7 Correct 5 ms 2000 KB Output is correct
8 Correct 2 ms 1744 KB Output is correct
9 Correct 2 ms 1720 KB Output is correct
10 Correct 4 ms 2068 KB Output is correct
11 Correct 4 ms 2356 KB Output is correct
12 Correct 0 ms 208 KB Output is correct
13 Correct 3 ms 1744 KB Output is correct
14 Correct 2 ms 1744 KB Output is correct
15 Correct 5 ms 2128 KB Output is correct
16 Correct 5 ms 2000 KB Output is correct
17 Correct 5 ms 2128 KB Output is correct
18 Correct 3 ms 1744 KB Output is correct
19 Correct 3 ms 2000 KB Output is correct
20 Correct 5 ms 2152 KB Output is correct
21 Correct 5 ms 2000 KB Output is correct
22 Correct 5 ms 2000 KB Output is correct
23 Correct 3 ms 1744 KB Output is correct
24 Correct 3 ms 1872 KB Output is correct
25 Correct 4 ms 1104 KB Output is correct
26 Correct 5 ms 2128 KB Output is correct
27 Correct 5 ms 2120 KB Output is correct
28 Correct 5 ms 2000 KB Output is correct
29 Correct 5 ms 2000 KB Output is correct
30 Correct 5 ms 2000 KB Output is correct
31 Correct 5 ms 2008 KB Output is correct
32 Correct 2 ms 1744 KB Output is correct
33 Correct 3 ms 1744 KB Output is correct
34 Correct 3 ms 1872 KB Output is correct
35 Correct 3 ms 2000 KB Output is correct
36 Correct 347 ms 67076 KB Output is correct
37 Correct 548 ms 103524 KB Output is correct
38 Correct 569 ms 104076 KB Output is correct
39 Correct 501 ms 98524 KB Output is correct
40 Correct 497 ms 98812 KB Output is correct
41 Correct 502 ms 98608 KB Output is correct
42 Correct 488 ms 97968 KB Output is correct
43 Correct 136 ms 87220 KB Output is correct
44 Correct 137 ms 87284 KB Output is correct
45 Correct 233 ms 107264 KB Output is correct
46 Correct 212 ms 103828 KB Output is correct
47 Correct 561 ms 104140 KB Output is correct
48 Correct 507 ms 97780 KB Output is correct
49 Correct 510 ms 97892 KB Output is correct
50 Correct 139 ms 87264 KB Output is correct
51 Correct 138 ms 88124 KB Output is correct
52 Correct 587 ms 104008 KB Output is correct
53 Correct 511 ms 97972 KB Output is correct
54 Correct 509 ms 97748 KB Output is correct
55 Correct 153 ms 87604 KB Output is correct
56 Correct 253 ms 110708 KB Output is correct
57 Correct 551 ms 100080 KB Output is correct
58 Correct 579 ms 103960 KB Output is correct
59 Correct 581 ms 103792 KB Output is correct
60 Correct 531 ms 98200 KB Output is correct
61 Correct 496 ms 98288 KB Output is correct
62 Correct 497 ms 98060 KB Output is correct
63 Correct 530 ms 97536 KB Output is correct
64 Correct 144 ms 87224 KB Output is correct
65 Correct 138 ms 87340 KB Output is correct
66 Correct 270 ms 113996 KB Output is correct
67 Correct 150 ms 89176 KB Output is correct
68 Correct 1487 ms 103564 KB Output is correct
69 Correct 1651 ms 104276 KB Output is correct
70 Correct 1775 ms 103452 KB Output is correct
71 Correct 1603 ms 97972 KB Output is correct
72 Correct 1581 ms 97984 KB Output is correct
73 Correct 1541 ms 98480 KB Output is correct
74 Correct 1562 ms 98152 KB Output is correct
75 Correct 1143 ms 87272 KB Output is correct
76 Correct 1125 ms 87276 KB Output is correct
77 Correct 1258 ms 99456 KB Output is correct
78 Correct 1220 ms 108768 KB Output is correct
79 Correct 1111 ms 87460 KB Output is correct
80 Correct 1102 ms 87312 KB Output is correct
81 Correct 0 ms 208 KB Output is correct
82 Correct 3 ms 1744 KB Output is correct
83 Correct 3 ms 1744 KB Output is correct
84 Correct 561 ms 104084 KB Output is correct
85 Correct 493 ms 97916 KB Output is correct
86 Correct 507 ms 97808 KB Output is correct
87 Correct 139 ms 87224 KB Output is correct
88 Correct 148 ms 88104 KB Output is correct
89 Correct 592 ms 104172 KB Output is correct
90 Correct 503 ms 97912 KB Output is correct
91 Correct 500 ms 97816 KB Output is correct
92 Correct 140 ms 87380 KB Output is correct
93 Correct 257 ms 110692 KB Output is correct
94 Correct 5 ms 2128 KB Output is correct
95 Correct 5 ms 2000 KB Output is correct
96 Correct 5 ms 2048 KB Output is correct
97 Correct 2 ms 1744 KB Output is correct
98 Correct 3 ms 2000 KB Output is correct
99 Correct 5 ms 2128 KB Output is correct
100 Correct 5 ms 2000 KB Output is correct
101 Correct 5 ms 2008 KB Output is correct
102 Correct 3 ms 1744 KB Output is correct
103 Correct 3 ms 1872 KB Output is correct
104 Correct 1499 ms 92344 KB Output is correct
105 Correct 1724 ms 103876 KB Output is correct
106 Correct 1761 ms 103824 KB Output is correct
107 Correct 1628 ms 98052 KB Output is correct
108 Correct 1635 ms 98000 KB Output is correct
109 Correct 1703 ms 97848 KB Output is correct
110 Correct 1742 ms 98228 KB Output is correct
111 Correct 1242 ms 87348 KB Output is correct
112 Correct 1234 ms 87328 KB Output is correct
113 Correct 1351 ms 120600 KB Output is correct
114 Correct 1382 ms 108532 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 545 ms 49748 KB Output is correct
2 Correct 1346 ms 87488 KB Output is correct
3 Correct 1239 ms 87592 KB Output is correct
4 Correct 1181 ms 87280 KB Output is correct
5 Correct 1230 ms 87448 KB Output is correct
6 Correct 1056 ms 87364 KB Output is correct
7 Correct 1129 ms 87312 KB Output is correct
8 Correct 0 ms 208 KB Output is correct
9 Correct 2 ms 1744 KB Output is correct
10 Correct 2 ms 1744 KB Output is correct
11 Correct 1 ms 592 KB Output is correct
12 Correct 6 ms 2128 KB Output is correct
13 Correct 6 ms 2184 KB Output is correct
14 Correct 5 ms 2000 KB Output is correct
15 Correct 5 ms 2000 KB Output is correct
16 Correct 5 ms 2000 KB Output is correct
17 Correct 5 ms 2000 KB Output is correct
18 Correct 2 ms 1744 KB Output is correct
19 Correct 2 ms 1720 KB Output is correct
20 Correct 4 ms 2068 KB Output is correct
21 Correct 4 ms 2356 KB Output is correct
22 Correct 0 ms 208 KB Output is correct
23 Correct 3 ms 1744 KB Output is correct
24 Correct 2 ms 1744 KB Output is correct
25 Correct 5 ms 2128 KB Output is correct
26 Correct 5 ms 2000 KB Output is correct
27 Correct 5 ms 2128 KB Output is correct
28 Correct 3 ms 1744 KB Output is correct
29 Correct 3 ms 2000 KB Output is correct
30 Correct 5 ms 2152 KB Output is correct
31 Correct 5 ms 2000 KB Output is correct
32 Correct 5 ms 2000 KB Output is correct
33 Correct 3 ms 1744 KB Output is correct
34 Correct 3 ms 1872 KB Output is correct
35 Correct 4 ms 1104 KB Output is correct
36 Correct 5 ms 2128 KB Output is correct
37 Correct 5 ms 2120 KB Output is correct
38 Correct 5 ms 2000 KB Output is correct
39 Correct 5 ms 2000 KB Output is correct
40 Correct 5 ms 2000 KB Output is correct
41 Correct 5 ms 2008 KB Output is correct
42 Correct 2 ms 1744 KB Output is correct
43 Correct 3 ms 1744 KB Output is correct
44 Correct 3 ms 1872 KB Output is correct
45 Correct 3 ms 2000 KB Output is correct
46 Correct 347 ms 67076 KB Output is correct
47 Correct 548 ms 103524 KB Output is correct
48 Correct 569 ms 104076 KB Output is correct
49 Correct 501 ms 98524 KB Output is correct
50 Correct 497 ms 98812 KB Output is correct
51 Correct 502 ms 98608 KB Output is correct
52 Correct 488 ms 97968 KB Output is correct
53 Correct 136 ms 87220 KB Output is correct
54 Correct 137 ms 87284 KB Output is correct
55 Correct 233 ms 107264 KB Output is correct
56 Correct 212 ms 103828 KB Output is correct
57 Correct 561 ms 104140 KB Output is correct
58 Correct 507 ms 97780 KB Output is correct
59 Correct 510 ms 97892 KB Output is correct
60 Correct 139 ms 87264 KB Output is correct
61 Correct 138 ms 88124 KB Output is correct
62 Correct 587 ms 104008 KB Output is correct
63 Correct 511 ms 97972 KB Output is correct
64 Correct 509 ms 97748 KB Output is correct
65 Correct 153 ms 87604 KB Output is correct
66 Correct 253 ms 110708 KB Output is correct
67 Correct 551 ms 100080 KB Output is correct
68 Correct 579 ms 103960 KB Output is correct
69 Correct 581 ms 103792 KB Output is correct
70 Correct 531 ms 98200 KB Output is correct
71 Correct 496 ms 98288 KB Output is correct
72 Correct 497 ms 98060 KB Output is correct
73 Correct 530 ms 97536 KB Output is correct
74 Correct 144 ms 87224 KB Output is correct
75 Correct 138 ms 87340 KB Output is correct
76 Correct 270 ms 113996 KB Output is correct
77 Correct 150 ms 89176 KB Output is correct
78 Correct 1487 ms 103564 KB Output is correct
79 Correct 1651 ms 104276 KB Output is correct
80 Correct 1775 ms 103452 KB Output is correct
81 Correct 1603 ms 97972 KB Output is correct
82 Correct 1581 ms 97984 KB Output is correct
83 Correct 1541 ms 98480 KB Output is correct
84 Correct 1562 ms 98152 KB Output is correct
85 Correct 1143 ms 87272 KB Output is correct
86 Correct 1125 ms 87276 KB Output is correct
87 Correct 1258 ms 99456 KB Output is correct
88 Correct 1220 ms 108768 KB Output is correct
89 Correct 1111 ms 87460 KB Output is correct
90 Correct 1102 ms 87312 KB Output is correct
91 Correct 0 ms 208 KB Output is correct
92 Correct 3 ms 1744 KB Output is correct
93 Correct 3 ms 1744 KB Output is correct
94 Correct 561 ms 104084 KB Output is correct
95 Correct 493 ms 97916 KB Output is correct
96 Correct 507 ms 97808 KB Output is correct
97 Correct 139 ms 87224 KB Output is correct
98 Correct 148 ms 88104 KB Output is correct
99 Correct 592 ms 104172 KB Output is correct
100 Correct 503 ms 97912 KB Output is correct
101 Correct 500 ms 97816 KB Output is correct
102 Correct 140 ms 87380 KB Output is correct
103 Correct 257 ms 110692 KB Output is correct
104 Correct 5 ms 2128 KB Output is correct
105 Correct 5 ms 2000 KB Output is correct
106 Correct 5 ms 2048 KB Output is correct
107 Correct 2 ms 1744 KB Output is correct
108 Correct 3 ms 2000 KB Output is correct
109 Correct 5 ms 2128 KB Output is correct
110 Correct 5 ms 2000 KB Output is correct
111 Correct 5 ms 2008 KB Output is correct
112 Correct 3 ms 1744 KB Output is correct
113 Correct 3 ms 1872 KB Output is correct
114 Correct 390 ms 24472 KB Output is correct
115 Correct 1434 ms 104852 KB Output is correct
116 Correct 1250 ms 103608 KB Output is correct
117 Correct 1295 ms 98024 KB Output is correct
118 Correct 1209 ms 97680 KB Output is correct
119 Correct 1294 ms 97900 KB Output is correct
120 Correct 1420 ms 98152 KB Output is correct
121 Correct 1048 ms 87308 KB Output is correct
122 Correct 802 ms 87220 KB Output is correct
123 Correct 1090 ms 112804 KB Output is correct
124 Correct 1097 ms 118412 KB Output is correct
125 Correct 564 ms 104084 KB Output is correct
126 Correct 503 ms 97688 KB Output is correct
127 Correct 494 ms 97712 KB Output is correct
128 Correct 138 ms 87360 KB Output is correct
129 Correct 255 ms 110672 KB Output is correct
130 Correct 536 ms 99736 KB Output is correct
131 Correct 560 ms 103736 KB Output is correct
132 Correct 567 ms 103768 KB Output is correct
133 Correct 493 ms 98200 KB Output is correct
134 Correct 492 ms 98236 KB Output is correct
135 Correct 499 ms 98168 KB Output is correct
136 Correct 502 ms 97584 KB Output is correct
137 Correct 138 ms 87228 KB Output is correct
138 Correct 141 ms 87384 KB Output is correct
139 Correct 263 ms 114108 KB Output is correct
140 Correct 144 ms 89160 KB Output is correct
141 Correct 5 ms 2128 KB Output is correct
142 Correct 5 ms 2000 KB Output is correct
143 Correct 5 ms 2000 KB Output is correct
144 Correct 2 ms 1744 KB Output is correct
145 Correct 3 ms 1872 KB Output is correct
146 Correct 3 ms 1160 KB Output is correct
147 Correct 5 ms 2228 KB Output is correct
148 Correct 5 ms 2148 KB Output is correct
149 Correct 4 ms 2000 KB Output is correct
150 Correct 5 ms 2000 KB Output is correct
151 Correct 5 ms 2124 KB Output is correct
152 Correct 5 ms 2000 KB Output is correct
153 Correct 2 ms 1644 KB Output is correct
154 Correct 2 ms 1744 KB Output is correct
155 Correct 3 ms 1872 KB Output is correct
156 Correct 4 ms 2004 KB Output is correct
157 Correct 1499 ms 92344 KB Output is correct
158 Correct 1724 ms 103876 KB Output is correct
159 Correct 1761 ms 103824 KB Output is correct
160 Correct 1628 ms 98052 KB Output is correct
161 Correct 1635 ms 98000 KB Output is correct
162 Correct 1703 ms 97848 KB Output is correct
163 Correct 1742 ms 98228 KB Output is correct
164 Correct 1242 ms 87348 KB Output is correct
165 Correct 1234 ms 87328 KB Output is correct
166 Correct 1351 ms 120600 KB Output is correct
167 Correct 1382 ms 108532 KB Output is correct
168 Correct 0 ms 208 KB Output is correct
169 Correct 905 ms 35696 KB Output is correct
170 Correct 1921 ms 103496 KB Output is correct
171 Correct 1876 ms 104380 KB Output is correct
172 Correct 1786 ms 98600 KB Output is correct
173 Correct 1672 ms 97832 KB Output is correct
174 Correct 1801 ms 97516 KB Output is correct
175 Correct 1767 ms 97960 KB Output is correct
176 Correct 1223 ms 87260 KB Output is correct
177 Correct 1313 ms 87244 KB Output is correct
178 Correct 1516 ms 122432 KB Output is correct
179 Correct 1473 ms 106948 KB Output is correct