Submission #636358

# Submission time Handle Problem Language Result Execution time Memory
636358 2022-08-29T00:50:47 Z CodePlatina Radio Towers (IOI22_towers) C++17
100 / 100
1850 ms 494864 KB
#include "towers.h"
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <utility>
#include <tuple>
#define pii pair<int, int>
#define piii pair<int, pii>
#define pll pair<long long, long long>
#define plll pair<long long, pll>
#define tiii tuple<int, int, int>
#define tiiii tuple<int, int, int, int>
#define ff first
#define ss second
#define ee ss.ff
#define rr ss.ss
#define DEBUG
const int INF = (int)1e9 + 7;

using namespace std;

int N, M;
vector<int> H;
vector<int> P;
vector<int> indx;
vector<pii> indm;
vector<pii> LD, RD;
vector<int> GD;
vector<int> DS;
vector<int> DH;
vector<int> Lroot, Rroot, LDroot, RDroot;

int qryx(int l, int r)
{
    int ret = 0;
    for(int x = l + N, y = r + N; x != y; x >>= 1, y >>= 1)
    {
        if(x & 1) ret = max(ret, indx[x++]);
        if(y & 1) ret = max(ret, indx[--y]);
    }
    return ret;
}

int qrym(int l, int r)
{
    pii ret = {INF, INF};
    for(int x = l + N, y = r + N; x != y; x >>= 1, y >>= 1)
    {
        if(x & 1) ret = min(ret, indm[x++]);
        if(y & 1) ret = min(ret, indm[--y]);
    }
    return ret.ss;
}

struct SEG
{
    struct Node
    {
        int x;
        int l, r;
        Node(void) : x(0), l(-1), r(-1) {}
    }nd[40404040];
    int cnt = 0;

    int init(int s, int e, const vector<int> &V)
    {
        int ret = cnt++;

        if(s + 1 == e)
        {
            nd[ret].x = V[s];
            return ret;
        }

        int mid = s + e >> 1;
        nd[ret].l = init(s, mid, V);
        nd[ret].r = init(mid, e, V);
        nd[ret].x = nd[nd[ret].l].x + nd[nd[ret].r].x;
        return ret;
    }

    int upd(int ind, int s, int e, int x, int v)
    {
        int ret = cnt++;
        nd[ret] = nd[ind];

        if(s + 1 == e)
        {
            nd[ret].x += v;
            return ret;
        }

        int mid = s + e >> 1;
        if(x < mid) nd[ret].l = upd(nd[ret].l, s, mid, x, v);
        else nd[ret].r = upd(nd[ret].r, mid, e, x, v);
        nd[ret].x = nd[nd[ret].l].x + nd[nd[ret].r].x;
        return ret;
    }

    int qry(int ind, int s, int e, int l, int r)
    {
        if(e <= l || r <= s) return 0;
        if(l <= s && e <= r) return nd[ind].x;

        int mid = s + e >> 1;
        return qry(nd[ind].l, s, mid, l, r) + qry(nd[ind].r, mid, e, l, r);
    }
}seg;

void init(int _N, vector<int> _H)
{
    N = _N;
    H = _H;
    for(int i = 0; i < N; ++i) P.push_back(i);
    sort(P.begin(), P.end(), [](int x, int y){return H[x] < H[y];});
    indx.resize(2 * N);
    for(int i = 0; i < N; ++i) indx[i + N] = H[i];
    for(int i = N - 1; i >= 1; --i) indx[i] = max(indx[i << 1], indx[i << 1 | 1]);
    indm.resize(2 * N);
    for(int i = 0; i < N; ++i) indm[i + N] = { H[i], i };
    for(int i = N - 1; i >= 1; --i) indm[i] = min(indm[i << 1], indm[i << 1 | 1]);
    set<int> S;
    LD.resize(N);
    RD.resize(N);
    GD.resize(N);
    for(int i : P)
    {
        auto it = S.lower_bound(i);
        int l = (it == S.begin() ? -1 : *prev(it));
        int r = (it == S.end() ? N : *it);
        LD[i] = { l, qryx(l + 1, i + 1) - H[i] };
        RD[i] = { r, qryx(i, r) - H[i] };
        GD[i] = min(LD[i].ss, RD[i].ss);
        DH.push_back(LD[i].ss);
        DH.push_back(RD[i].ss);
        S.insert(i);
    }
    sort(DH.begin(), DH.end());
    DH.resize(unique(DH.begin(), DH.end()) - DH.begin());
    M = DH.size();
    for(int i = 0; i < N; ++i)
    {
        LD[i].ss = lower_bound(DH.begin(), DH.end(), LD[i].ss) - DH.begin();
        RD[i].ss = lower_bound(DH.begin(), DH.end(), RD[i].ss) - DH.begin();
        GD[i] = lower_bound(DH.begin(), DH.end(), GD[i]) - DH.begin();
        DS.push_back(GD[i]);
    }
    sort(DS.begin(), DS.end());
    Lroot.resize(N + 1);
    Rroot.resize(N + 1);
    vector<int> tmp(M);
    vector<int> ls[N + 1];
    for(int i = 0; i < N; ++i) ++tmp[GD[i]], ls[LD[i].ff + 1].push_back(i);
    Lroot[0] = Rroot[N] = seg.init(0, M, tmp);
    for(int i = 0; i <= N; ++i)
    {
        if(i) Lroot[i] = Lroot[i - 1];
        for(auto x : ls[i])
        {
            Lroot[i] = seg.upd(Lroot[i], 0, M, GD[x], -1);
            Lroot[i] = seg.upd(Lroot[i], 0, M, RD[x].ss, 1);
        }
    }
    for(auto &v : ls) v.clear();
    for(int i = 0; i < N; ++i) ls[RD[i].ff].push_back(i);
    for(int i = N - 1; i >= 0; --i)
    {
        Rroot[i] = Rroot[i + 1];
        for(auto x : ls[i + 1])
        {
            Rroot[i] = seg.upd(Rroot[i], 0, M, GD[x], -1);
            Rroot[i] = seg.upd(Rroot[i], 0, M, LD[x].ss, 1);
        }
    }
    LDroot.resize(N);
    LDroot[0] = seg.init(0, M, vector<int>(M));
    for(int i = 1; i < N; ++i) LDroot[i] = seg.upd(LDroot[i - 1], 0, M, RD[i - 1].ss, 1);
    RDroot.resize(N);
    RDroot[N - 1] = LDroot[0];
    for(int i = N - 2; i >= 0; --i) RDroot[i] = seg.upd(RDroot[i + 1], 0, M, LD[i + 1].ss, 1);


//    for(int i = 0; i < N; ++i)
//    {
//        cout << LD[i].ff << ' ' << LD[i].ss << ' ' << RD[i].ff << ' ' << RD[i].ss << endl;
//    }
}

int max_towers(int L, int R, int D)
{
    int x = qryx(L, R + 1);
    int m = qrym(L, R + 1);
    if(x - H[m] < D) return 1;
    D = lower_bound(DH.begin(), DH.end(), D) - DH.begin();
//    cout << seg.qry(Lroot[L], 0, M, D, M) << endl;
//    cout << seg.qry(Rroot[R], 0, M, D, M) << endl;
//    cout << (DS.end() - lower_bound(DS.begin(), DS.end(), D)) << endl;
//    cout << (GD[m] >= D ? 1 : 0) << endl;
//    cout << (LD[m].ss >= D ? 1 : 0) << endl;
//    cout << (RD[m].ss >= D ? 1 : 0) << endl;
//    cout << seg.qry(LDroot[L], 0, M, D, M) << endl;
//    cout << seg.qry(RDroot[R], 0, M, D, M) << endl;
    return seg.qry(Lroot[L], 0, M, D, M) + seg.qry(Rroot[R], 0, M, D, M)
            - (DS.end() - lower_bound(DS.begin(), DS.end(), D))
            + (GD[m] >= D ? 1 : 0) - (LD[m].ss >= D ? 1 : 0) - (RD[m].ss >= D ? 1 : 0)
            - seg.qry(LDroot[L], 0, M, D, M) - seg.qry(RDroot[R], 0, M, D, M) + 1;
}

Compilation message

towers.cpp: In member function 'int SEG::init(int, int, const std::vector<int>&)':
towers.cpp:76:21: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   76 |         int mid = s + e >> 1;
      |                   ~~^~~
towers.cpp: In member function 'int SEG::upd(int, int, int, int, int)':
towers.cpp:94:21: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   94 |         int mid = s + e >> 1;
      |                   ~~^~~
towers.cpp: In member function 'int SEG::qry(int, int, int, int, int)':
towers.cpp:106:21: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
  106 |         int mid = s + e >> 1;
      |                   ~~^~~
# Verdict Execution time Memory Grader output
1 Correct 776 ms 486400 KB Output is correct
2 Correct 1300 ms 494348 KB Output is correct
3 Correct 1322 ms 494360 KB Output is correct
4 Correct 1287 ms 494480 KB Output is correct
5 Correct 1285 ms 494244 KB Output is correct
6 Correct 1347 ms 494576 KB Output is correct
7 Correct 1402 ms 494232 KB Output is correct
8 Correct 196 ms 474672 KB Output is correct
9 Correct 201 ms 475036 KB Output is correct
10 Correct 203 ms 475052 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 199 ms 474724 KB Output is correct
2 Correct 195 ms 475028 KB Output is correct
3 Correct 214 ms 475040 KB Output is correct
4 Correct 199 ms 475044 KB Output is correct
5 Correct 195 ms 475036 KB Output is correct
6 Correct 203 ms 475120 KB Output is correct
7 Correct 197 ms 474952 KB Output is correct
8 Correct 205 ms 474960 KB Output is correct
9 Correct 198 ms 475024 KB Output is correct
10 Correct 201 ms 474960 KB Output is correct
11 Correct 199 ms 475032 KB Output is correct
12 Correct 196 ms 474696 KB Output is correct
13 Correct 199 ms 475036 KB Output is correct
14 Correct 200 ms 474952 KB Output is correct
15 Correct 201 ms 475044 KB Output is correct
16 Correct 206 ms 475052 KB Output is correct
17 Correct 199 ms 474976 KB Output is correct
18 Correct 198 ms 475080 KB Output is correct
19 Correct 204 ms 475100 KB Output is correct
20 Correct 200 ms 474952 KB Output is correct
21 Correct 199 ms 475016 KB Output is correct
22 Correct 201 ms 475040 KB Output is correct
23 Correct 198 ms 475064 KB Output is correct
24 Correct 211 ms 475056 KB Output is correct
25 Correct 197 ms 474764 KB Output is correct
26 Correct 199 ms 475036 KB Output is correct
27 Correct 196 ms 475032 KB Output is correct
28 Correct 200 ms 475060 KB Output is correct
29 Correct 203 ms 475028 KB Output is correct
30 Correct 202 ms 475004 KB Output is correct
31 Correct 198 ms 475056 KB Output is correct
32 Correct 199 ms 474984 KB Output is correct
33 Correct 199 ms 474952 KB Output is correct
34 Correct 200 ms 475020 KB Output is correct
35 Correct 199 ms 474952 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 199 ms 474724 KB Output is correct
2 Correct 195 ms 475028 KB Output is correct
3 Correct 214 ms 475040 KB Output is correct
4 Correct 199 ms 475044 KB Output is correct
5 Correct 195 ms 475036 KB Output is correct
6 Correct 203 ms 475120 KB Output is correct
7 Correct 197 ms 474952 KB Output is correct
8 Correct 205 ms 474960 KB Output is correct
9 Correct 198 ms 475024 KB Output is correct
10 Correct 201 ms 474960 KB Output is correct
11 Correct 199 ms 475032 KB Output is correct
12 Correct 196 ms 474696 KB Output is correct
13 Correct 199 ms 475036 KB Output is correct
14 Correct 200 ms 474952 KB Output is correct
15 Correct 201 ms 475044 KB Output is correct
16 Correct 206 ms 475052 KB Output is correct
17 Correct 199 ms 474976 KB Output is correct
18 Correct 198 ms 475080 KB Output is correct
19 Correct 204 ms 475100 KB Output is correct
20 Correct 200 ms 474952 KB Output is correct
21 Correct 199 ms 475016 KB Output is correct
22 Correct 201 ms 475040 KB Output is correct
23 Correct 198 ms 475064 KB Output is correct
24 Correct 211 ms 475056 KB Output is correct
25 Correct 197 ms 474764 KB Output is correct
26 Correct 199 ms 475036 KB Output is correct
27 Correct 196 ms 475032 KB Output is correct
28 Correct 200 ms 475060 KB Output is correct
29 Correct 203 ms 475028 KB Output is correct
30 Correct 202 ms 475004 KB Output is correct
31 Correct 198 ms 475056 KB Output is correct
32 Correct 199 ms 474984 KB Output is correct
33 Correct 199 ms 474952 KB Output is correct
34 Correct 200 ms 475020 KB Output is correct
35 Correct 199 ms 474952 KB Output is correct
36 Correct 337 ms 487360 KB Output is correct
37 Correct 428 ms 493908 KB Output is correct
38 Correct 426 ms 494028 KB Output is correct
39 Correct 434 ms 494052 KB Output is correct
40 Correct 419 ms 493936 KB Output is correct
41 Correct 426 ms 494084 KB Output is correct
42 Correct 418 ms 494004 KB Output is correct
43 Correct 361 ms 494292 KB Output is correct
44 Correct 345 ms 494272 KB Output is correct
45 Correct 357 ms 494664 KB Output is correct
46 Correct 347 ms 494268 KB Output is correct
47 Correct 441 ms 494092 KB Output is correct
48 Correct 423 ms 494012 KB Output is correct
49 Correct 435 ms 494084 KB Output is correct
50 Correct 349 ms 494284 KB Output is correct
51 Correct 353 ms 494404 KB Output is correct
52 Correct 446 ms 493988 KB Output is correct
53 Correct 428 ms 493884 KB Output is correct
54 Correct 419 ms 494012 KB Output is correct
55 Correct 363 ms 494296 KB Output is correct
56 Correct 354 ms 494524 KB Output is correct
57 Correct 417 ms 493400 KB Output is correct
58 Correct 427 ms 493980 KB Output is correct
59 Correct 427 ms 494108 KB Output is correct
60 Correct 433 ms 493884 KB Output is correct
61 Correct 434 ms 494136 KB Output is correct
62 Correct 425 ms 494012 KB Output is correct
63 Correct 418 ms 493900 KB Output is correct
64 Correct 349 ms 494524 KB Output is correct
65 Correct 348 ms 494172 KB Output is correct
66 Correct 356 ms 494500 KB Output is correct
67 Correct 359 ms 494264 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1262 ms 493896 KB Output is correct
2 Correct 1415 ms 494048 KB Output is correct
3 Correct 1416 ms 494012 KB Output is correct
4 Correct 1565 ms 494048 KB Output is correct
5 Correct 1475 ms 494100 KB Output is correct
6 Correct 1482 ms 494008 KB Output is correct
7 Correct 1482 ms 494016 KB Output is correct
8 Correct 1263 ms 494396 KB Output is correct
9 Correct 1264 ms 494300 KB Output is correct
10 Correct 1299 ms 494864 KB Output is correct
11 Correct 1288 ms 494280 KB Output is correct
12 Correct 1301 ms 494412 KB Output is correct
13 Correct 1381 ms 494188 KB Output is correct
14 Correct 201 ms 474684 KB Output is correct
15 Correct 198 ms 474984 KB Output is correct
16 Correct 210 ms 475016 KB Output is correct
17 Correct 431 ms 494008 KB Output is correct
18 Correct 436 ms 494012 KB Output is correct
19 Correct 430 ms 493944 KB Output is correct
20 Correct 346 ms 494280 KB Output is correct
21 Correct 359 ms 494544 KB Output is correct
22 Correct 427 ms 493888 KB Output is correct
23 Correct 427 ms 494092 KB Output is correct
24 Correct 424 ms 493996 KB Output is correct
25 Correct 349 ms 494268 KB Output is correct
26 Correct 356 ms 494512 KB Output is correct
27 Correct 204 ms 475152 KB Output is correct
28 Correct 199 ms 474988 KB Output is correct
29 Correct 200 ms 475048 KB Output is correct
30 Correct 199 ms 475060 KB Output is correct
31 Correct 196 ms 475180 KB Output is correct
32 Correct 199 ms 474984 KB Output is correct
33 Correct 200 ms 474952 KB Output is correct
34 Correct 199 ms 474996 KB Output is correct
35 Correct 199 ms 474952 KB Output is correct
36 Correct 199 ms 475044 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 532 ms 479300 KB Output is correct
2 Correct 1345 ms 494044 KB Output is correct
3 Correct 1299 ms 493904 KB Output is correct
4 Correct 1375 ms 494148 KB Output is correct
5 Correct 1431 ms 494008 KB Output is correct
6 Correct 1276 ms 494000 KB Output is correct
7 Correct 1348 ms 493920 KB Output is correct
8 Correct 1355 ms 494652 KB Output is correct
9 Correct 1380 ms 494284 KB Output is correct
10 Correct 1171 ms 494564 KB Output is correct
11 Correct 1195 ms 494268 KB Output is correct
12 Correct 432 ms 493888 KB Output is correct
13 Correct 434 ms 493932 KB Output is correct
14 Correct 431 ms 493924 KB Output is correct
15 Correct 354 ms 494288 KB Output is correct
16 Correct 363 ms 494724 KB Output is correct
17 Correct 435 ms 493320 KB Output is correct
18 Correct 433 ms 493948 KB Output is correct
19 Correct 421 ms 494128 KB Output is correct
20 Correct 428 ms 494128 KB Output is correct
21 Correct 423 ms 494028 KB Output is correct
22 Correct 421 ms 493996 KB Output is correct
23 Correct 428 ms 494040 KB Output is correct
24 Correct 353 ms 494420 KB Output is correct
25 Correct 349 ms 494316 KB Output is correct
26 Correct 355 ms 494524 KB Output is correct
27 Correct 345 ms 494264 KB Output is correct
28 Correct 205 ms 475092 KB Output is correct
29 Correct 196 ms 475036 KB Output is correct
30 Correct 198 ms 475012 KB Output is correct
31 Correct 203 ms 475064 KB Output is correct
32 Correct 200 ms 475080 KB Output is correct
33 Correct 198 ms 474760 KB Output is correct
34 Correct 197 ms 475000 KB Output is correct
35 Correct 201 ms 475060 KB Output is correct
36 Correct 201 ms 474952 KB Output is correct
37 Correct 202 ms 475032 KB Output is correct
38 Correct 200 ms 475208 KB Output is correct
39 Correct 197 ms 474996 KB Output is correct
40 Correct 198 ms 475080 KB Output is correct
41 Correct 201 ms 475188 KB Output is correct
42 Correct 197 ms 475080 KB Output is correct
43 Correct 200 ms 475004 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 199 ms 474724 KB Output is correct
2 Correct 195 ms 475028 KB Output is correct
3 Correct 214 ms 475040 KB Output is correct
4 Correct 199 ms 475044 KB Output is correct
5 Correct 195 ms 475036 KB Output is correct
6 Correct 203 ms 475120 KB Output is correct
7 Correct 197 ms 474952 KB Output is correct
8 Correct 205 ms 474960 KB Output is correct
9 Correct 198 ms 475024 KB Output is correct
10 Correct 201 ms 474960 KB Output is correct
11 Correct 199 ms 475032 KB Output is correct
12 Correct 196 ms 474696 KB Output is correct
13 Correct 199 ms 475036 KB Output is correct
14 Correct 200 ms 474952 KB Output is correct
15 Correct 201 ms 475044 KB Output is correct
16 Correct 206 ms 475052 KB Output is correct
17 Correct 199 ms 474976 KB Output is correct
18 Correct 198 ms 475080 KB Output is correct
19 Correct 204 ms 475100 KB Output is correct
20 Correct 200 ms 474952 KB Output is correct
21 Correct 199 ms 475016 KB Output is correct
22 Correct 201 ms 475040 KB Output is correct
23 Correct 198 ms 475064 KB Output is correct
24 Correct 211 ms 475056 KB Output is correct
25 Correct 197 ms 474764 KB Output is correct
26 Correct 199 ms 475036 KB Output is correct
27 Correct 196 ms 475032 KB Output is correct
28 Correct 200 ms 475060 KB Output is correct
29 Correct 203 ms 475028 KB Output is correct
30 Correct 202 ms 475004 KB Output is correct
31 Correct 198 ms 475056 KB Output is correct
32 Correct 199 ms 474984 KB Output is correct
33 Correct 199 ms 474952 KB Output is correct
34 Correct 200 ms 475020 KB Output is correct
35 Correct 199 ms 474952 KB Output is correct
36 Correct 337 ms 487360 KB Output is correct
37 Correct 428 ms 493908 KB Output is correct
38 Correct 426 ms 494028 KB Output is correct
39 Correct 434 ms 494052 KB Output is correct
40 Correct 419 ms 493936 KB Output is correct
41 Correct 426 ms 494084 KB Output is correct
42 Correct 418 ms 494004 KB Output is correct
43 Correct 361 ms 494292 KB Output is correct
44 Correct 345 ms 494272 KB Output is correct
45 Correct 357 ms 494664 KB Output is correct
46 Correct 347 ms 494268 KB Output is correct
47 Correct 441 ms 494092 KB Output is correct
48 Correct 423 ms 494012 KB Output is correct
49 Correct 435 ms 494084 KB Output is correct
50 Correct 349 ms 494284 KB Output is correct
51 Correct 353 ms 494404 KB Output is correct
52 Correct 446 ms 493988 KB Output is correct
53 Correct 428 ms 493884 KB Output is correct
54 Correct 419 ms 494012 KB Output is correct
55 Correct 363 ms 494296 KB Output is correct
56 Correct 354 ms 494524 KB Output is correct
57 Correct 417 ms 493400 KB Output is correct
58 Correct 427 ms 493980 KB Output is correct
59 Correct 427 ms 494108 KB Output is correct
60 Correct 433 ms 493884 KB Output is correct
61 Correct 434 ms 494136 KB Output is correct
62 Correct 425 ms 494012 KB Output is correct
63 Correct 418 ms 493900 KB Output is correct
64 Correct 349 ms 494524 KB Output is correct
65 Correct 348 ms 494172 KB Output is correct
66 Correct 356 ms 494500 KB Output is correct
67 Correct 359 ms 494264 KB Output is correct
68 Correct 1262 ms 493896 KB Output is correct
69 Correct 1415 ms 494048 KB Output is correct
70 Correct 1416 ms 494012 KB Output is correct
71 Correct 1565 ms 494048 KB Output is correct
72 Correct 1475 ms 494100 KB Output is correct
73 Correct 1482 ms 494008 KB Output is correct
74 Correct 1482 ms 494016 KB Output is correct
75 Correct 1263 ms 494396 KB Output is correct
76 Correct 1264 ms 494300 KB Output is correct
77 Correct 1299 ms 494864 KB Output is correct
78 Correct 1288 ms 494280 KB Output is correct
79 Correct 1301 ms 494412 KB Output is correct
80 Correct 1381 ms 494188 KB Output is correct
81 Correct 201 ms 474684 KB Output is correct
82 Correct 198 ms 474984 KB Output is correct
83 Correct 210 ms 475016 KB Output is correct
84 Correct 431 ms 494008 KB Output is correct
85 Correct 436 ms 494012 KB Output is correct
86 Correct 430 ms 493944 KB Output is correct
87 Correct 346 ms 494280 KB Output is correct
88 Correct 359 ms 494544 KB Output is correct
89 Correct 427 ms 493888 KB Output is correct
90 Correct 427 ms 494092 KB Output is correct
91 Correct 424 ms 493996 KB Output is correct
92 Correct 349 ms 494268 KB Output is correct
93 Correct 356 ms 494512 KB Output is correct
94 Correct 204 ms 475152 KB Output is correct
95 Correct 199 ms 474988 KB Output is correct
96 Correct 200 ms 475048 KB Output is correct
97 Correct 199 ms 475060 KB Output is correct
98 Correct 196 ms 475180 KB Output is correct
99 Correct 199 ms 474984 KB Output is correct
100 Correct 200 ms 474952 KB Output is correct
101 Correct 199 ms 474996 KB Output is correct
102 Correct 199 ms 474952 KB Output is correct
103 Correct 199 ms 475044 KB Output is correct
104 Correct 1280 ms 491840 KB Output is correct
105 Correct 1569 ms 493900 KB Output is correct
106 Correct 1574 ms 493968 KB Output is correct
107 Correct 1557 ms 493952 KB Output is correct
108 Correct 1548 ms 494000 KB Output is correct
109 Correct 1510 ms 494076 KB Output is correct
110 Correct 1510 ms 493932 KB Output is correct
111 Correct 1295 ms 494424 KB Output is correct
112 Correct 1133 ms 494264 KB Output is correct
113 Correct 1325 ms 494692 KB Output is correct
114 Correct 1256 ms 494260 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 776 ms 486400 KB Output is correct
2 Correct 1300 ms 494348 KB Output is correct
3 Correct 1322 ms 494360 KB Output is correct
4 Correct 1287 ms 494480 KB Output is correct
5 Correct 1285 ms 494244 KB Output is correct
6 Correct 1347 ms 494576 KB Output is correct
7 Correct 1402 ms 494232 KB Output is correct
8 Correct 196 ms 474672 KB Output is correct
9 Correct 201 ms 475036 KB Output is correct
10 Correct 203 ms 475052 KB Output is correct
11 Correct 199 ms 474724 KB Output is correct
12 Correct 195 ms 475028 KB Output is correct
13 Correct 214 ms 475040 KB Output is correct
14 Correct 199 ms 475044 KB Output is correct
15 Correct 195 ms 475036 KB Output is correct
16 Correct 203 ms 475120 KB Output is correct
17 Correct 197 ms 474952 KB Output is correct
18 Correct 205 ms 474960 KB Output is correct
19 Correct 198 ms 475024 KB Output is correct
20 Correct 201 ms 474960 KB Output is correct
21 Correct 199 ms 475032 KB Output is correct
22 Correct 196 ms 474696 KB Output is correct
23 Correct 199 ms 475036 KB Output is correct
24 Correct 200 ms 474952 KB Output is correct
25 Correct 201 ms 475044 KB Output is correct
26 Correct 206 ms 475052 KB Output is correct
27 Correct 199 ms 474976 KB Output is correct
28 Correct 198 ms 475080 KB Output is correct
29 Correct 204 ms 475100 KB Output is correct
30 Correct 200 ms 474952 KB Output is correct
31 Correct 199 ms 475016 KB Output is correct
32 Correct 201 ms 475040 KB Output is correct
33 Correct 198 ms 475064 KB Output is correct
34 Correct 211 ms 475056 KB Output is correct
35 Correct 197 ms 474764 KB Output is correct
36 Correct 199 ms 475036 KB Output is correct
37 Correct 196 ms 475032 KB Output is correct
38 Correct 200 ms 475060 KB Output is correct
39 Correct 203 ms 475028 KB Output is correct
40 Correct 202 ms 475004 KB Output is correct
41 Correct 198 ms 475056 KB Output is correct
42 Correct 199 ms 474984 KB Output is correct
43 Correct 199 ms 474952 KB Output is correct
44 Correct 200 ms 475020 KB Output is correct
45 Correct 199 ms 474952 KB Output is correct
46 Correct 337 ms 487360 KB Output is correct
47 Correct 428 ms 493908 KB Output is correct
48 Correct 426 ms 494028 KB Output is correct
49 Correct 434 ms 494052 KB Output is correct
50 Correct 419 ms 493936 KB Output is correct
51 Correct 426 ms 494084 KB Output is correct
52 Correct 418 ms 494004 KB Output is correct
53 Correct 361 ms 494292 KB Output is correct
54 Correct 345 ms 494272 KB Output is correct
55 Correct 357 ms 494664 KB Output is correct
56 Correct 347 ms 494268 KB Output is correct
57 Correct 441 ms 494092 KB Output is correct
58 Correct 423 ms 494012 KB Output is correct
59 Correct 435 ms 494084 KB Output is correct
60 Correct 349 ms 494284 KB Output is correct
61 Correct 353 ms 494404 KB Output is correct
62 Correct 446 ms 493988 KB Output is correct
63 Correct 428 ms 493884 KB Output is correct
64 Correct 419 ms 494012 KB Output is correct
65 Correct 363 ms 494296 KB Output is correct
66 Correct 354 ms 494524 KB Output is correct
67 Correct 417 ms 493400 KB Output is correct
68 Correct 427 ms 493980 KB Output is correct
69 Correct 427 ms 494108 KB Output is correct
70 Correct 433 ms 493884 KB Output is correct
71 Correct 434 ms 494136 KB Output is correct
72 Correct 425 ms 494012 KB Output is correct
73 Correct 418 ms 493900 KB Output is correct
74 Correct 349 ms 494524 KB Output is correct
75 Correct 348 ms 494172 KB Output is correct
76 Correct 356 ms 494500 KB Output is correct
77 Correct 359 ms 494264 KB Output is correct
78 Correct 1262 ms 493896 KB Output is correct
79 Correct 1415 ms 494048 KB Output is correct
80 Correct 1416 ms 494012 KB Output is correct
81 Correct 1565 ms 494048 KB Output is correct
82 Correct 1475 ms 494100 KB Output is correct
83 Correct 1482 ms 494008 KB Output is correct
84 Correct 1482 ms 494016 KB Output is correct
85 Correct 1263 ms 494396 KB Output is correct
86 Correct 1264 ms 494300 KB Output is correct
87 Correct 1299 ms 494864 KB Output is correct
88 Correct 1288 ms 494280 KB Output is correct
89 Correct 1301 ms 494412 KB Output is correct
90 Correct 1381 ms 494188 KB Output is correct
91 Correct 201 ms 474684 KB Output is correct
92 Correct 198 ms 474984 KB Output is correct
93 Correct 210 ms 475016 KB Output is correct
94 Correct 431 ms 494008 KB Output is correct
95 Correct 436 ms 494012 KB Output is correct
96 Correct 430 ms 493944 KB Output is correct
97 Correct 346 ms 494280 KB Output is correct
98 Correct 359 ms 494544 KB Output is correct
99 Correct 427 ms 493888 KB Output is correct
100 Correct 427 ms 494092 KB Output is correct
101 Correct 424 ms 493996 KB Output is correct
102 Correct 349 ms 494268 KB Output is correct
103 Correct 356 ms 494512 KB Output is correct
104 Correct 204 ms 475152 KB Output is correct
105 Correct 199 ms 474988 KB Output is correct
106 Correct 200 ms 475048 KB Output is correct
107 Correct 199 ms 475060 KB Output is correct
108 Correct 196 ms 475180 KB Output is correct
109 Correct 199 ms 474984 KB Output is correct
110 Correct 200 ms 474952 KB Output is correct
111 Correct 199 ms 474996 KB Output is correct
112 Correct 199 ms 474952 KB Output is correct
113 Correct 199 ms 475044 KB Output is correct
114 Correct 532 ms 479300 KB Output is correct
115 Correct 1345 ms 494044 KB Output is correct
116 Correct 1299 ms 493904 KB Output is correct
117 Correct 1375 ms 494148 KB Output is correct
118 Correct 1431 ms 494008 KB Output is correct
119 Correct 1276 ms 494000 KB Output is correct
120 Correct 1348 ms 493920 KB Output is correct
121 Correct 1355 ms 494652 KB Output is correct
122 Correct 1380 ms 494284 KB Output is correct
123 Correct 1171 ms 494564 KB Output is correct
124 Correct 1195 ms 494268 KB Output is correct
125 Correct 432 ms 493888 KB Output is correct
126 Correct 434 ms 493932 KB Output is correct
127 Correct 431 ms 493924 KB Output is correct
128 Correct 354 ms 494288 KB Output is correct
129 Correct 363 ms 494724 KB Output is correct
130 Correct 435 ms 493320 KB Output is correct
131 Correct 433 ms 493948 KB Output is correct
132 Correct 421 ms 494128 KB Output is correct
133 Correct 428 ms 494128 KB Output is correct
134 Correct 423 ms 494028 KB Output is correct
135 Correct 421 ms 493996 KB Output is correct
136 Correct 428 ms 494040 KB Output is correct
137 Correct 353 ms 494420 KB Output is correct
138 Correct 349 ms 494316 KB Output is correct
139 Correct 355 ms 494524 KB Output is correct
140 Correct 345 ms 494264 KB Output is correct
141 Correct 205 ms 475092 KB Output is correct
142 Correct 196 ms 475036 KB Output is correct
143 Correct 198 ms 475012 KB Output is correct
144 Correct 203 ms 475064 KB Output is correct
145 Correct 200 ms 475080 KB Output is correct
146 Correct 198 ms 474760 KB Output is correct
147 Correct 197 ms 475000 KB Output is correct
148 Correct 201 ms 475060 KB Output is correct
149 Correct 201 ms 474952 KB Output is correct
150 Correct 202 ms 475032 KB Output is correct
151 Correct 200 ms 475208 KB Output is correct
152 Correct 197 ms 474996 KB Output is correct
153 Correct 198 ms 475080 KB Output is correct
154 Correct 201 ms 475188 KB Output is correct
155 Correct 197 ms 475080 KB Output is correct
156 Correct 200 ms 475004 KB Output is correct
157 Correct 1280 ms 491840 KB Output is correct
158 Correct 1569 ms 493900 KB Output is correct
159 Correct 1574 ms 493968 KB Output is correct
160 Correct 1557 ms 493952 KB Output is correct
161 Correct 1548 ms 494000 KB Output is correct
162 Correct 1510 ms 494076 KB Output is correct
163 Correct 1510 ms 493932 KB Output is correct
164 Correct 1295 ms 494424 KB Output is correct
165 Correct 1133 ms 494264 KB Output is correct
166 Correct 1325 ms 494692 KB Output is correct
167 Correct 1256 ms 494260 KB Output is correct
168 Correct 197 ms 474656 KB Output is correct
169 Correct 1099 ms 481288 KB Output is correct
170 Correct 1757 ms 494060 KB Output is correct
171 Correct 1699 ms 494028 KB Output is correct
172 Correct 1808 ms 493876 KB Output is correct
173 Correct 1674 ms 493948 KB Output is correct
174 Correct 1717 ms 494016 KB Output is correct
175 Correct 1850 ms 494108 KB Output is correct
176 Correct 1264 ms 494468 KB Output is correct
177 Correct 1316 ms 494288 KB Output is correct
178 Correct 1334 ms 494704 KB Output is correct
179 Correct 1299 ms 494268 KB Output is correct