Submission #1066292

# Submission time Handle Problem Language Result Execution time Memory
1066292 2024-08-19T17:26:24 Z j_vdd16 Radio Towers (IOI22_towers) C++17
100 / 100
2871 ms 200500 KB
#include "towers.h"

#include <algorithm>
#include <bitset>
#include <cstdint>
#include <cstring>
#include <iostream>
#include <limits.h>
#include <math.h>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

//#define int long long
#define loop(X, N) for(int X = 0; X < (N); X++)
#define all(V) V.begin(), V.end()
#define rall(V) V.rbegin(), V.rend()

using namespace std;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<vector<ii>> vvii;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;

typedef uint64_t u64;
typedef int64_t i64;


struct MSTree {
    int n, N;

    typedef map<int, int, greater<int>> Entry;
    vector<Entry> tree;

    MSTree() = default;
    MSTree(const vi& values) {
        n = values.size();
        N = 1;
        while (N < n) N *= 2;

        tree = vector<Entry>(2 * N);

        loop(i, n) {
            tree[N + i] = {{values[i], 1}};
        }
        for (int i = N - 1; i >= 1; i--) {
            tree[i] = merge(tree[2 * i], tree[2 * i + 1]);
        }
    }

    Entry merge(const Entry& a, const Entry& b) {
        Entry out;

        auto it1 = a.begin();
        auto it2 = b.begin();
        int pref1 = 0;
        int pref2 = 0;
        
        while (it1 != a.end() && it2 != b.end()) {
            if (it1->first > it2->first) {
                pref1 = it1->second;
                out[it1->first] = pref1 + pref2;

                it1++;
            }
            else {
                pref2 = it2->second;
                out[it2->first] = pref1 + pref2;

                it2++;
            }
        }

        while (it1 != a.end()) {
            pref1 = it1->second;
            out[it1->first] = pref1 + pref2;

            it1++;
        }
        while (it2 != b.end()) {
            pref2 = it2->second;
            out[it2->first] = pref1 + pref2;

            it2++;
        }

        return out;
    }

    int range(int l, int r, int v, int i = 1, int tl = 0, int tr = -1) {
        if (tr == -1) tr = N;

        if (l <= tl && r >= tr) {
            auto it = tree[i].upper_bound(v);
            if (it == tree[i].begin())
                return 0;
            
            return (--it)->second;
        }

        if (tl >= r || tr <= l) {
            return 0;
        }

        int tm = (tl + tr) / 2;
        return range(l, r, v, i * 2, tl, tm) + range(l, r, v, i * 2 + 1, tm, tr);
    }
    int leftMost(int l, int r, int v, int i = 1, int tl = 0, int tr = -1) {
        if (tr == -1) tr = N;

        if (tl >= r || tr <= l) {
            return -1;
        }

        int curVal;
        auto it = tree[i].upper_bound(v);
        if (it == tree[i].begin())
            curVal = -1;
        else
            curVal = tl;
            
        if (tr - tl == 1) {
            return curVal;
        }

        int tm = (tl + tr) / 2;
        int val1 = leftMost(l, r, v, i * 2, tl, tm);
        if (val1 >= 0)
            return val1;

        if (curVal == -1)
            return -1;

        return leftMost(l, r, v, i * 2 + 1, tm, tr);
    }
    int rightMost(int l, int r, int v, int i = 1, int tl = 0, int tr = -1) {
        if (tr == -1) tr = N;

        if (tl >= r || tr <= l) {
            return -1;
        }

        int curVal;
        auto it = tree[i].upper_bound(v);
        if (it == tree[i].begin())
            curVal = -1;
        else
            curVal = tl;

        if (tr - tl == 1) {
            return curVal;
        }

        int tm = (tl + tr) / 2;
        int val1 = rightMost(l, r, v, i * 2 + 1, tm, tr);
        if (val1 >= 0)
            return val1;
            
        if (curVal == -1)
            return -1;

        return rightMost(l, r, v, i * 2, tl, tm);
    }
};
struct SparseTable {
    int n;
    vii table[17];
    vi values;

    SparseTable(const vi& _values) {
        n = _values.size();
        values = _values;

        table[0] = vii(n);
        for (int i = 0; i < n; i++) {
            table[0][i] = { i, i };
        }
        for (int pow = 1; pow < 17; pow++) {
            if (n - (1 << pow) + 1 <= 0) 
                break;

            table[pow] = vii(n - (1 << pow) + 1);
            for (int i = 0; i + (1 << pow) <= n; i++) {
                ii v1 = table[pow - 1][i];
                ii v2 = table[pow - 1][i + (1 << pow) / 2];
                if (values[v1.first] < values[v2.first]) {
                    table[pow][i].first = v1.first;
                }
                else {
                    table[pow][i].first = v2.first;
                }
                if (values[v1.second] > values[v2.second]) {
                    table[pow][i].second = v1.second;
                }
                else {
                    table[pow][i].second = v2.second;
                }
            }
        }
    }

    int minIdx(int l, int r) {
        int exp = 0;
        while ((1 << exp) * 2 <= r - l + 1)
            exp++;

        int pow = 1 << exp;

        ii v1 = table[exp][l];
        ii v2 = table[exp][r - pow + 1];
        if (values[v1.first] < values[v2.first]) {
            return v1.first;
        }
        else {
            return v2.first;
        }
    }
    int maxIdx(int l, int r) {
        int exp = 0;
        while ((1 << exp) * 2 <= r - l + 1)
            exp++;

        int pow = 1 << exp;

        ii v1 = table[exp][l];
        ii v2 = table[exp][r - pow + 1];
        if (values[v1.second] > values[v2.second]) {
            return v1.second;
        }
        else {
            return v2.second;
        }
    }
};

int n;
vi h;

vi bestD, bestLeftD, bestRightD;
MSTree allD, leftD, rightD;
void init(int N, std::vector<int> H) {
    //all H[i] are different
    //dp[i] = max of 1 and all dp[j] over j s.t. j < i && maxH(j, i) - D >= max(H[i], H[j])

    //D = 1
    //H = 1, 2, 6, 4, 5, 3, 7
    //dp= 1, 1, 1, 2, 2, 3, 1

    //count no. of i for which there exist l, r such that h[i] = minH[l, r] && h[i] + D <= h[l], h[r]

    n = N;
    h = H;

    if (n == 1) return;

    SparseTable sparse(H);
    sparse.minIdx(1, 1);

    bestD = vi(n), bestLeftD = vi(n), bestRightD = vi(n);
    loop(i, n) {
        int minLeft, minRight;
        {
            int l = -1, r = i - 1;
            while (l < r) {
                int m = (l + r + 1) / 2;

                int minIdx = sparse.minIdx(m, r);
                if (h[minIdx] < h[i]) {
                    l = m;
                }
                else {
                    r = m - 1;
                }
            }
            minLeft = l;
        }
        {
            int l = i + 1, r = n;
            while (l < r) {
                int m = (l + r) / 2;

                int minIdx = sparse.minIdx(l, m);
                if (h[minIdx] < h[i]) {
                    r = m;
                }
                else {
                    l = m + 1;
                }
            }
            minRight = r;
        }

        //cout << i << ' ' << minLeft << ' ' << minRight << endl;
        if (minLeft + 1 <= i - 1 && minRight - 1 >= i + 1) {
            bestD[i] = min(h[sparse.maxIdx(minLeft + 1, i - 1)], h[sparse.maxIdx(i + 1, minRight - 1)]) - h[i];
        }

        if (minRight - 1 >= i + 1) {
            bestLeftD[i] = h[sparse.maxIdx(i + 1, minRight - 1)] - h[i];
        }
        if (minLeft + 1 <= i - 1) {
            bestRightD[i] = h[sparse.maxIdx(minLeft + 1, i - 1)] - h[i];
        }
    }

    allD = MSTree(bestD);
    leftD = MSTree(bestLeftD);
    rightD = MSTree(bestRightD);
}

int max_towers(int L, int R, int D) {
    if (L == R) {
        return 1;
    }

    int left = leftD.leftMost(L, R + 1, D);
    int right = rightD.rightMost(L, R + 1, D);
    if (left == -1 || right == -1 || left + 1 > right - 1) {
        return 1;
    }

    int extra = allD.range(left + 1, right - 1 + 1, D);
    return 2 + extra;
}
# Verdict Execution time Memory Grader output
1 Correct 604 ms 86160 KB Output is correct
2 Correct 1410 ms 155984 KB Output is correct
3 Correct 1463 ms 155728 KB Output is correct
4 Correct 1257 ms 155728 KB Output is correct
5 Correct 1264 ms 155752 KB Output is correct
6 Correct 1229 ms 155720 KB Output is correct
7 Correct 1289 ms 155528 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 3 ms 2648 KB Output is correct
10 Correct 3 ms 2900 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 856 KB Output is correct
2 Correct 4 ms 3160 KB Output is correct
3 Correct 7 ms 3160 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 3 ms 2648 KB Output is correct
9 Correct 3 ms 2648 KB Output is correct
10 Correct 3 ms 2648 KB Output is correct
11 Correct 3 ms 2648 KB Output is correct
12 Correct 1 ms 344 KB Output is correct
13 Correct 4 ms 2648 KB Output is correct
14 Correct 5 ms 2648 KB Output is correct
15 Correct 7 ms 3120 KB Output is correct
16 Correct 7 ms 3352 KB Output is correct
17 Correct 7 ms 3160 KB Output is correct
18 Correct 4 ms 2648 KB Output is correct
19 Correct 3 ms 2900 KB Output is correct
20 Correct 4 ms 3160 KB Output is correct
21 Correct 4 ms 3160 KB Output is correct
22 Correct 5 ms 3160 KB Output is correct
23 Correct 3 ms 2648 KB Output is correct
24 Correct 3 ms 2648 KB Output is correct
25 Correct 2 ms 1368 KB Output is correct
26 Correct 4 ms 3160 KB Output is correct
27 Correct 4 ms 3080 KB Output is correct
28 Correct 4 ms 3160 KB Output is correct
29 Correct 7 ms 3160 KB Output is correct
30 Correct 4 ms 3160 KB Output is correct
31 Correct 4 ms 3160 KB Output is correct
32 Correct 3 ms 2572 KB Output is correct
33 Correct 3 ms 2648 KB Output is correct
34 Correct 3 ms 2648 KB Output is correct
35 Correct 3 ms 2648 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 856 KB Output is correct
2 Correct 4 ms 3160 KB Output is correct
3 Correct 7 ms 3160 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 3 ms 2648 KB Output is correct
9 Correct 3 ms 2648 KB Output is correct
10 Correct 3 ms 2648 KB Output is correct
11 Correct 3 ms 2648 KB Output is correct
12 Correct 1 ms 344 KB Output is correct
13 Correct 4 ms 2648 KB Output is correct
14 Correct 5 ms 2648 KB Output is correct
15 Correct 7 ms 3120 KB Output is correct
16 Correct 7 ms 3352 KB Output is correct
17 Correct 7 ms 3160 KB Output is correct
18 Correct 4 ms 2648 KB Output is correct
19 Correct 3 ms 2900 KB Output is correct
20 Correct 4 ms 3160 KB Output is correct
21 Correct 4 ms 3160 KB Output is correct
22 Correct 5 ms 3160 KB Output is correct
23 Correct 3 ms 2648 KB Output is correct
24 Correct 3 ms 2648 KB Output is correct
25 Correct 2 ms 1368 KB Output is correct
26 Correct 4 ms 3160 KB Output is correct
27 Correct 4 ms 3080 KB Output is correct
28 Correct 4 ms 3160 KB Output is correct
29 Correct 7 ms 3160 KB Output is correct
30 Correct 4 ms 3160 KB Output is correct
31 Correct 4 ms 3160 KB Output is correct
32 Correct 3 ms 2572 KB Output is correct
33 Correct 3 ms 2648 KB Output is correct
34 Correct 3 ms 2648 KB Output is correct
35 Correct 3 ms 2648 KB Output is correct
36 Correct 165 ms 111184 KB Output is correct
37 Correct 286 ms 186160 KB Output is correct
38 Correct 277 ms 186172 KB Output is correct
39 Correct 376 ms 200272 KB Output is correct
40 Correct 358 ms 200160 KB Output is correct
41 Correct 301 ms 200196 KB Output is correct
42 Correct 292 ms 200352 KB Output is correct
43 Correct 232 ms 155544 KB Output is correct
44 Correct 228 ms 155624 KB Output is correct
45 Correct 224 ms 155672 KB Output is correct
46 Correct 241 ms 155728 KB Output is correct
47 Correct 324 ms 186120 KB Output is correct
48 Correct 312 ms 200256 KB Output is correct
49 Correct 319 ms 200500 KB Output is correct
50 Correct 215 ms 155544 KB Output is correct
51 Correct 215 ms 155732 KB Output is correct
52 Correct 345 ms 186192 KB Output is correct
53 Correct 310 ms 200336 KB Output is correct
54 Correct 350 ms 200268 KB Output is correct
55 Correct 249 ms 155732 KB Output is correct
56 Correct 214 ms 155728 KB Output is correct
57 Correct 307 ms 181072 KB Output is correct
58 Correct 304 ms 186448 KB Output is correct
59 Correct 269 ms 186192 KB Output is correct
60 Correct 382 ms 200328 KB Output is correct
61 Correct 308 ms 200436 KB Output is correct
62 Correct 319 ms 200312 KB Output is correct
63 Correct 339 ms 200340 KB Output is correct
64 Correct 229 ms 155728 KB Output is correct
65 Correct 199 ms 155572 KB Output is correct
66 Correct 257 ms 155728 KB Output is correct
67 Correct 266 ms 155728 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1780 ms 184892 KB Output is correct
2 Correct 2178 ms 186148 KB Output is correct
3 Correct 2087 ms 186188 KB Output is correct
4 Correct 2233 ms 200272 KB Output is correct
5 Correct 2201 ms 200308 KB Output is correct
6 Correct 2140 ms 200212 KB Output is correct
7 Correct 2295 ms 200272 KB Output is correct
8 Correct 1240 ms 155728 KB Output is correct
9 Correct 1291 ms 155724 KB Output is correct
10 Correct 1437 ms 155728 KB Output is correct
11 Correct 1424 ms 155728 KB Output is correct
12 Correct 1287 ms 155728 KB Output is correct
13 Correct 1299 ms 155628 KB Output is correct
14 Correct 1 ms 344 KB Output is correct
15 Correct 3 ms 2648 KB Output is correct
16 Correct 3 ms 2648 KB Output is correct
17 Correct 280 ms 186192 KB Output is correct
18 Correct 308 ms 200272 KB Output is correct
19 Correct 292 ms 200344 KB Output is correct
20 Correct 214 ms 155540 KB Output is correct
21 Correct 220 ms 155628 KB Output is correct
22 Correct 288 ms 186192 KB Output is correct
23 Correct 291 ms 200216 KB Output is correct
24 Correct 290 ms 200360 KB Output is correct
25 Correct 211 ms 155536 KB Output is correct
26 Correct 208 ms 155520 KB Output is correct
27 Correct 5 ms 3160 KB Output is correct
28 Correct 4 ms 3160 KB Output is correct
29 Correct 4 ms 3160 KB Output is correct
30 Correct 4 ms 2648 KB Output is correct
31 Correct 3 ms 2648 KB Output is correct
32 Correct 4 ms 3160 KB Output is correct
33 Correct 5 ms 3160 KB Output is correct
34 Correct 4 ms 3160 KB Output is correct
35 Correct 3 ms 2648 KB Output is correct
36 Correct 3 ms 2648 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 395 ms 41804 KB Output is correct
2 Correct 1517 ms 186192 KB Output is correct
3 Correct 1537 ms 186192 KB Output is correct
4 Correct 1591 ms 200272 KB Output is correct
5 Correct 1581 ms 200312 KB Output is correct
6 Correct 1623 ms 200248 KB Output is correct
7 Correct 1681 ms 200272 KB Output is correct
8 Correct 1040 ms 155676 KB Output is correct
9 Correct 981 ms 155544 KB Output is correct
10 Correct 1058 ms 155680 KB Output is correct
11 Correct 1020 ms 155728 KB Output is correct
12 Correct 282 ms 186192 KB Output is correct
13 Correct 292 ms 200272 KB Output is correct
14 Correct 321 ms 200340 KB Output is correct
15 Correct 216 ms 155568 KB Output is correct
16 Correct 211 ms 155708 KB Output is correct
17 Correct 265 ms 181072 KB Output is correct
18 Correct 278 ms 186244 KB Output is correct
19 Correct 290 ms 186192 KB Output is correct
20 Correct 288 ms 200296 KB Output is correct
21 Correct 292 ms 200276 KB Output is correct
22 Correct 293 ms 200176 KB Output is correct
23 Correct 305 ms 200136 KB Output is correct
24 Correct 213 ms 155588 KB Output is correct
25 Correct 202 ms 155520 KB Output is correct
26 Correct 197 ms 155728 KB Output is correct
27 Correct 201 ms 155532 KB Output is correct
28 Correct 4 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 3 ms 2648 KB Output is correct
32 Correct 5 ms 2648 KB Output is correct
33 Correct 3 ms 1472 KB Output is correct
34 Correct 4 ms 3172 KB Output is correct
35 Correct 4 ms 3024 KB Output is correct
36 Correct 6 ms 3348 KB Output is correct
37 Correct 5 ms 3160 KB Output is correct
38 Correct 5 ms 3160 KB Output is correct
39 Correct 4 ms 3224 KB Output is correct
40 Correct 3 ms 2648 KB Output is correct
41 Correct 3 ms 2648 KB Output is correct
42 Correct 3 ms 2648 KB Output is correct
43 Correct 3 ms 2536 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 856 KB Output is correct
2 Correct 4 ms 3160 KB Output is correct
3 Correct 7 ms 3160 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 3 ms 2648 KB Output is correct
9 Correct 3 ms 2648 KB Output is correct
10 Correct 3 ms 2648 KB Output is correct
11 Correct 3 ms 2648 KB Output is correct
12 Correct 1 ms 344 KB Output is correct
13 Correct 4 ms 2648 KB Output is correct
14 Correct 5 ms 2648 KB Output is correct
15 Correct 7 ms 3120 KB Output is correct
16 Correct 7 ms 3352 KB Output is correct
17 Correct 7 ms 3160 KB Output is correct
18 Correct 4 ms 2648 KB Output is correct
19 Correct 3 ms 2900 KB Output is correct
20 Correct 4 ms 3160 KB Output is correct
21 Correct 4 ms 3160 KB Output is correct
22 Correct 5 ms 3160 KB Output is correct
23 Correct 3 ms 2648 KB Output is correct
24 Correct 3 ms 2648 KB Output is correct
25 Correct 2 ms 1368 KB Output is correct
26 Correct 4 ms 3160 KB Output is correct
27 Correct 4 ms 3080 KB Output is correct
28 Correct 4 ms 3160 KB Output is correct
29 Correct 7 ms 3160 KB Output is correct
30 Correct 4 ms 3160 KB Output is correct
31 Correct 4 ms 3160 KB Output is correct
32 Correct 3 ms 2572 KB Output is correct
33 Correct 3 ms 2648 KB Output is correct
34 Correct 3 ms 2648 KB Output is correct
35 Correct 3 ms 2648 KB Output is correct
36 Correct 165 ms 111184 KB Output is correct
37 Correct 286 ms 186160 KB Output is correct
38 Correct 277 ms 186172 KB Output is correct
39 Correct 376 ms 200272 KB Output is correct
40 Correct 358 ms 200160 KB Output is correct
41 Correct 301 ms 200196 KB Output is correct
42 Correct 292 ms 200352 KB Output is correct
43 Correct 232 ms 155544 KB Output is correct
44 Correct 228 ms 155624 KB Output is correct
45 Correct 224 ms 155672 KB Output is correct
46 Correct 241 ms 155728 KB Output is correct
47 Correct 324 ms 186120 KB Output is correct
48 Correct 312 ms 200256 KB Output is correct
49 Correct 319 ms 200500 KB Output is correct
50 Correct 215 ms 155544 KB Output is correct
51 Correct 215 ms 155732 KB Output is correct
52 Correct 345 ms 186192 KB Output is correct
53 Correct 310 ms 200336 KB Output is correct
54 Correct 350 ms 200268 KB Output is correct
55 Correct 249 ms 155732 KB Output is correct
56 Correct 214 ms 155728 KB Output is correct
57 Correct 307 ms 181072 KB Output is correct
58 Correct 304 ms 186448 KB Output is correct
59 Correct 269 ms 186192 KB Output is correct
60 Correct 382 ms 200328 KB Output is correct
61 Correct 308 ms 200436 KB Output is correct
62 Correct 319 ms 200312 KB Output is correct
63 Correct 339 ms 200340 KB Output is correct
64 Correct 229 ms 155728 KB Output is correct
65 Correct 199 ms 155572 KB Output is correct
66 Correct 257 ms 155728 KB Output is correct
67 Correct 266 ms 155728 KB Output is correct
68 Correct 1780 ms 184892 KB Output is correct
69 Correct 2178 ms 186148 KB Output is correct
70 Correct 2087 ms 186188 KB Output is correct
71 Correct 2233 ms 200272 KB Output is correct
72 Correct 2201 ms 200308 KB Output is correct
73 Correct 2140 ms 200212 KB Output is correct
74 Correct 2295 ms 200272 KB Output is correct
75 Correct 1240 ms 155728 KB Output is correct
76 Correct 1291 ms 155724 KB Output is correct
77 Correct 1437 ms 155728 KB Output is correct
78 Correct 1424 ms 155728 KB Output is correct
79 Correct 1287 ms 155728 KB Output is correct
80 Correct 1299 ms 155628 KB Output is correct
81 Correct 1 ms 344 KB Output is correct
82 Correct 3 ms 2648 KB Output is correct
83 Correct 3 ms 2648 KB Output is correct
84 Correct 280 ms 186192 KB Output is correct
85 Correct 308 ms 200272 KB Output is correct
86 Correct 292 ms 200344 KB Output is correct
87 Correct 214 ms 155540 KB Output is correct
88 Correct 220 ms 155628 KB Output is correct
89 Correct 288 ms 186192 KB Output is correct
90 Correct 291 ms 200216 KB Output is correct
91 Correct 290 ms 200360 KB Output is correct
92 Correct 211 ms 155536 KB Output is correct
93 Correct 208 ms 155520 KB Output is correct
94 Correct 5 ms 3160 KB Output is correct
95 Correct 4 ms 3160 KB Output is correct
96 Correct 4 ms 3160 KB Output is correct
97 Correct 4 ms 2648 KB Output is correct
98 Correct 3 ms 2648 KB Output is correct
99 Correct 4 ms 3160 KB Output is correct
100 Correct 5 ms 3160 KB Output is correct
101 Correct 4 ms 3160 KB Output is correct
102 Correct 3 ms 2648 KB Output is correct
103 Correct 3 ms 2648 KB Output is correct
104 Correct 1531 ms 169296 KB Output is correct
105 Correct 1666 ms 186116 KB Output is correct
106 Correct 1599 ms 186280 KB Output is correct
107 Correct 1700 ms 200272 KB Output is correct
108 Correct 1589 ms 200272 KB Output is correct
109 Correct 1731 ms 200320 KB Output is correct
110 Correct 1963 ms 200236 KB Output is correct
111 Correct 1173 ms 155728 KB Output is correct
112 Correct 1138 ms 155764 KB Output is correct
113 Correct 1137 ms 155728 KB Output is correct
114 Correct 1320 ms 155728 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 604 ms 86160 KB Output is correct
2 Correct 1410 ms 155984 KB Output is correct
3 Correct 1463 ms 155728 KB Output is correct
4 Correct 1257 ms 155728 KB Output is correct
5 Correct 1264 ms 155752 KB Output is correct
6 Correct 1229 ms 155720 KB Output is correct
7 Correct 1289 ms 155528 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 3 ms 2648 KB Output is correct
10 Correct 3 ms 2900 KB Output is correct
11 Correct 1 ms 856 KB Output is correct
12 Correct 4 ms 3160 KB Output is correct
13 Correct 7 ms 3160 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 3 ms 2648 KB Output is correct
19 Correct 3 ms 2648 KB Output is correct
20 Correct 3 ms 2648 KB Output is correct
21 Correct 3 ms 2648 KB Output is correct
22 Correct 1 ms 344 KB Output is correct
23 Correct 4 ms 2648 KB Output is correct
24 Correct 5 ms 2648 KB Output is correct
25 Correct 7 ms 3120 KB Output is correct
26 Correct 7 ms 3352 KB Output is correct
27 Correct 7 ms 3160 KB Output is correct
28 Correct 4 ms 2648 KB Output is correct
29 Correct 3 ms 2900 KB Output is correct
30 Correct 4 ms 3160 KB Output is correct
31 Correct 4 ms 3160 KB Output is correct
32 Correct 5 ms 3160 KB Output is correct
33 Correct 3 ms 2648 KB Output is correct
34 Correct 3 ms 2648 KB Output is correct
35 Correct 2 ms 1368 KB Output is correct
36 Correct 4 ms 3160 KB Output is correct
37 Correct 4 ms 3080 KB Output is correct
38 Correct 4 ms 3160 KB Output is correct
39 Correct 7 ms 3160 KB Output is correct
40 Correct 4 ms 3160 KB Output is correct
41 Correct 4 ms 3160 KB Output is correct
42 Correct 3 ms 2572 KB Output is correct
43 Correct 3 ms 2648 KB Output is correct
44 Correct 3 ms 2648 KB Output is correct
45 Correct 3 ms 2648 KB Output is correct
46 Correct 165 ms 111184 KB Output is correct
47 Correct 286 ms 186160 KB Output is correct
48 Correct 277 ms 186172 KB Output is correct
49 Correct 376 ms 200272 KB Output is correct
50 Correct 358 ms 200160 KB Output is correct
51 Correct 301 ms 200196 KB Output is correct
52 Correct 292 ms 200352 KB Output is correct
53 Correct 232 ms 155544 KB Output is correct
54 Correct 228 ms 155624 KB Output is correct
55 Correct 224 ms 155672 KB Output is correct
56 Correct 241 ms 155728 KB Output is correct
57 Correct 324 ms 186120 KB Output is correct
58 Correct 312 ms 200256 KB Output is correct
59 Correct 319 ms 200500 KB Output is correct
60 Correct 215 ms 155544 KB Output is correct
61 Correct 215 ms 155732 KB Output is correct
62 Correct 345 ms 186192 KB Output is correct
63 Correct 310 ms 200336 KB Output is correct
64 Correct 350 ms 200268 KB Output is correct
65 Correct 249 ms 155732 KB Output is correct
66 Correct 214 ms 155728 KB Output is correct
67 Correct 307 ms 181072 KB Output is correct
68 Correct 304 ms 186448 KB Output is correct
69 Correct 269 ms 186192 KB Output is correct
70 Correct 382 ms 200328 KB Output is correct
71 Correct 308 ms 200436 KB Output is correct
72 Correct 319 ms 200312 KB Output is correct
73 Correct 339 ms 200340 KB Output is correct
74 Correct 229 ms 155728 KB Output is correct
75 Correct 199 ms 155572 KB Output is correct
76 Correct 257 ms 155728 KB Output is correct
77 Correct 266 ms 155728 KB Output is correct
78 Correct 1780 ms 184892 KB Output is correct
79 Correct 2178 ms 186148 KB Output is correct
80 Correct 2087 ms 186188 KB Output is correct
81 Correct 2233 ms 200272 KB Output is correct
82 Correct 2201 ms 200308 KB Output is correct
83 Correct 2140 ms 200212 KB Output is correct
84 Correct 2295 ms 200272 KB Output is correct
85 Correct 1240 ms 155728 KB Output is correct
86 Correct 1291 ms 155724 KB Output is correct
87 Correct 1437 ms 155728 KB Output is correct
88 Correct 1424 ms 155728 KB Output is correct
89 Correct 1287 ms 155728 KB Output is correct
90 Correct 1299 ms 155628 KB Output is correct
91 Correct 1 ms 344 KB Output is correct
92 Correct 3 ms 2648 KB Output is correct
93 Correct 3 ms 2648 KB Output is correct
94 Correct 280 ms 186192 KB Output is correct
95 Correct 308 ms 200272 KB Output is correct
96 Correct 292 ms 200344 KB Output is correct
97 Correct 214 ms 155540 KB Output is correct
98 Correct 220 ms 155628 KB Output is correct
99 Correct 288 ms 186192 KB Output is correct
100 Correct 291 ms 200216 KB Output is correct
101 Correct 290 ms 200360 KB Output is correct
102 Correct 211 ms 155536 KB Output is correct
103 Correct 208 ms 155520 KB Output is correct
104 Correct 5 ms 3160 KB Output is correct
105 Correct 4 ms 3160 KB Output is correct
106 Correct 4 ms 3160 KB Output is correct
107 Correct 4 ms 2648 KB Output is correct
108 Correct 3 ms 2648 KB Output is correct
109 Correct 4 ms 3160 KB Output is correct
110 Correct 5 ms 3160 KB Output is correct
111 Correct 4 ms 3160 KB Output is correct
112 Correct 3 ms 2648 KB Output is correct
113 Correct 3 ms 2648 KB Output is correct
114 Correct 395 ms 41804 KB Output is correct
115 Correct 1517 ms 186192 KB Output is correct
116 Correct 1537 ms 186192 KB Output is correct
117 Correct 1591 ms 200272 KB Output is correct
118 Correct 1581 ms 200312 KB Output is correct
119 Correct 1623 ms 200248 KB Output is correct
120 Correct 1681 ms 200272 KB Output is correct
121 Correct 1040 ms 155676 KB Output is correct
122 Correct 981 ms 155544 KB Output is correct
123 Correct 1058 ms 155680 KB Output is correct
124 Correct 1020 ms 155728 KB Output is correct
125 Correct 282 ms 186192 KB Output is correct
126 Correct 292 ms 200272 KB Output is correct
127 Correct 321 ms 200340 KB Output is correct
128 Correct 216 ms 155568 KB Output is correct
129 Correct 211 ms 155708 KB Output is correct
130 Correct 265 ms 181072 KB Output is correct
131 Correct 278 ms 186244 KB Output is correct
132 Correct 290 ms 186192 KB Output is correct
133 Correct 288 ms 200296 KB Output is correct
134 Correct 292 ms 200276 KB Output is correct
135 Correct 293 ms 200176 KB Output is correct
136 Correct 305 ms 200136 KB Output is correct
137 Correct 213 ms 155588 KB Output is correct
138 Correct 202 ms 155520 KB Output is correct
139 Correct 197 ms 155728 KB Output is correct
140 Correct 201 ms 155532 KB Output is correct
141 Correct 4 ms 3160 KB Output is correct
142 Correct 4 ms 3160 KB Output is correct
143 Correct 4 ms 3160 KB Output is correct
144 Correct 3 ms 2648 KB Output is correct
145 Correct 5 ms 2648 KB Output is correct
146 Correct 3 ms 1472 KB Output is correct
147 Correct 4 ms 3172 KB Output is correct
148 Correct 4 ms 3024 KB Output is correct
149 Correct 6 ms 3348 KB Output is correct
150 Correct 5 ms 3160 KB Output is correct
151 Correct 5 ms 3160 KB Output is correct
152 Correct 4 ms 3224 KB Output is correct
153 Correct 3 ms 2648 KB Output is correct
154 Correct 3 ms 2648 KB Output is correct
155 Correct 3 ms 2648 KB Output is correct
156 Correct 3 ms 2536 KB Output is correct
157 Correct 1531 ms 169296 KB Output is correct
158 Correct 1666 ms 186116 KB Output is correct
159 Correct 1599 ms 186280 KB Output is correct
160 Correct 1700 ms 200272 KB Output is correct
161 Correct 1589 ms 200272 KB Output is correct
162 Correct 1731 ms 200320 KB Output is correct
163 Correct 1963 ms 200236 KB Output is correct
164 Correct 1173 ms 155728 KB Output is correct
165 Correct 1138 ms 155764 KB Output is correct
166 Correct 1137 ms 155728 KB Output is correct
167 Correct 1320 ms 155728 KB Output is correct
168 Correct 1 ms 344 KB Output is correct
169 Correct 1289 ms 67948 KB Output is correct
170 Correct 2636 ms 185992 KB Output is correct
171 Correct 2626 ms 186192 KB Output is correct
172 Correct 2679 ms 200272 KB Output is correct
173 Correct 2871 ms 200300 KB Output is correct
174 Correct 2738 ms 200248 KB Output is correct
175 Correct 2644 ms 200384 KB Output is correct
176 Correct 1224 ms 155760 KB Output is correct
177 Correct 1279 ms 155764 KB Output is correct
178 Correct 1238 ms 155544 KB Output is correct
179 Correct 1171 ms 155888 KB Output is correct