Submission #716571

# Submission time Handle Problem Language Result Execution time Memory
716571 2023-03-30T11:37:04 Z Jarif_Rahman Radio Towers (IOI22_towers) C++17
100 / 100
1952 ms 216212 KB
#include <bits/stdc++.h>
#define pb push_back
#define f first
#define sc second
using namespace std;
typedef long long int ll;
typedef string str;

struct segtree{
    int k = 1;
    vector<int> v;
    segtree(int n){
        while(k < n) k*=2;
        v.assign(2*k, 0);
    }
    void update(int i, int x){
        i+=k;
        v[i] = x;
        i/=2;
        while(i){
            v[i] = max(v[2*i], v[2*i+1]);
            i/=2;
        }
    }
    int get(int l, int r, int nd, int a, int b){
        if(a > r || b < l) return 0;
        if(a >= l && b <= r) return v[nd];
        int md = (a+b)/2;
        return max(get(l, r, 2*nd, a, md), get(l, r, 2*nd+1, md+1, b));
    }
    int get(int l, int r){
        if(l > r) return 0;
        return get(l, r, 1, 0, k-1);
    }
};

struct persistent_segtree{
    struct Node{
        int x;
        Node *l = nullptr, *r = nullptr;
        Node(int _x = 0): x(_x){}
        Node(Node* _l, Node* _r): x(_l->x+_r->x), l(_l), r(_r){}
    };

    int k = 1;
    persistent_segtree(int n){
        while(k < n) k<<=1;
    }

    void init_rec(Node* nd, int a, int b){
        if(a == b) return;
        nd->l = new Node();
        nd->r = new Node();
        int md = (a+b)>>1;
        init_rec(nd->l, a, md);
        init_rec(nd->r, md+1, b);
    }
    Node* init(){
        auto nd = new Node();
        init_rec(nd, 0, k-1);
        return nd;
    }

    Node* update(Node* nd, int a, int b, int i, int x){
        if(a == b) return new Node(nd->x+x);
        int md = (a+b)>>1;
        if(i <= md) return new Node(update(nd->l, a, md, i, x), nd->r);
        return new Node(nd->l, update(nd->r, md+1, b, i, x));
    }
    Node* update(Node* nd, int i, int x){
        return update(nd, 0, k-1, i, x);
    }

    int sum(Node* nd, int a, int b, int l, int r){
        if(a > r || b < l) return 0;
        if(a >= l && b <= r) return nd->x;
        int md = (a+b)>>1;
        return sum(nd->l, a, md, l, r)+sum(nd->r, md+1, b, l, r);
    }
    int sum(Node* nd, int l, int r){
        if(l > r) return 0;
        return sum(nd, 0, k-1, l, r);
    }

    int first_one(Node* nd, int l, int r, int a, int b){
        if(a > r || b < l) return -1;
        if(nd->x == 0) return -1;
        if(a == b) return a;
        int md = (a+b)>>1;
        int rt = first_one(nd->l, l, r, a, md);
        if(rt == -1) return first_one(nd->r, l, r, md+1, b);
        return rt;
    }
    int first_one(Node *nd, int l, int r){
        return first_one(nd, l, r, 0, k-1);
    }
    int last_one(Node* nd, int l, int r, int a, int b){
        if(a > r || b < l) return -1;
        if(nd->x == 0) return -1;
        if(a == b) return a;
        int md = (a+b)>>1;
        int rt = last_one(nd->r, l, r, md+1, b);
        if(rt == -1) return last_one(nd->l, l, r, a, md);
        return rt;
    }
    int last_one(Node *nd, int l, int r){
        return last_one(nd, l, r, 0, k-1);
    }
};

int n;
vector<int> h;
segtree seg(0);
vector<int> DL, DR, DLR;
vector<int> SL, SR;

vector<int> cmpr;
map<int, int> mp;

persistent_segtree psL(0), psR(0), psLR(0);
vector<persistent_segtree::Node*> ndL, ndR, ndLR;

void init(int _n, vector<int> _h){
    swap(n, _n);
    swap(h, _h);
    seg = segtree(n);
    DR.assign(n, 1e9);
    DL.assign(n, 1e9);
    DLR.assign(n, 1e9);
    SL.assign(n, 0);
    SR.resize(n, n-1);

    for(int i = 0; i < n; i++) seg.update(i, h[i]);

    stack<int> st;
    for(int i = n-1; i >= 0; i--){
        while(!st.empty() && h[i] < h[st.top()]){
            SL[st.top()] = i;
            DL[st.top()] = max(0, seg.get(i, st.top())-h[st.top()]);
            st.pop();
        }
        st.push(i);
    }
    while(!st.empty()) st.pop();
    for(int i = 0; i < n; i++){
        while(!st.empty() && h[i] < h[st.top()]){
            SR[st.top()] = i;
            DR[st.top()] = max(0, seg.get(st.top(), i)-h[st.top()]);
            st.pop();
        }
        st.push(i);
    }
    while(!st.empty()) st.pop();

    for(int i = 0; i < n; i++) cmpr.pb(DL[i]), cmpr.pb(DR[i]);
    sort(cmpr.begin(), cmpr.end());
    for(int i = 0; i < cmpr.size(); i++) mp[cmpr[i]] = i;
    for(int &x: DL) x = mp[x];
    for(int &x: DR) x = mp[x];
    for(int i = 0;  i < n; i++) DLR[i] = min(DL[i], DR[i]);

    psL = persistent_segtree(n);
    psR = persistent_segtree(n);
    psLR = persistent_segtree(n);
    ndL.resize(2*n);
    ndR.resize(2*n);
    ndLR.resize(2*n);

    vector<vector<int>> sth(2*n);

    ndL[2*n-1] = psL.init();
    for(int i = 0; i < n; i++) sth[DL[i]].pb(i);
    for(int i = 2*n-1; i >= 0; i--){
        if(i+1 < 2*n) ndL[i] = ndL[i+1];
        for(int j: sth[i]) ndL[i] = psL.update(ndL[i], j, 1);
        sth[i].clear();
    }

    ndR[2*n-1] = psR.init();
    for(int i = 0; i < n; i++) sth[DR[i]].pb(i);
    for(int i = 2*n-1; i >= 0; i--){
        if(i+1 < 2*n) ndR[i] = ndR[i+1];
        for(int j: sth[i]) ndR[i] = psR.update(ndR[i], j, 1);
        sth[i].clear();
    }

    ndLR[2*n-1] = psLR.init();
    for(int i = 0; i < n; i++) sth[DLR[i]].pb(i);
    for(int i = 2*n-1; i >= 0; i--){
        if(i+1 < 2*n) ndLR[i] = ndLR[i+1];
        for(int j: sth[i]) ndLR[i] = psLR.update(ndLR[i], j, 1);
        sth[i].clear();
    }
}

int max_towers(int L, int R, int D){
    auto it = lower_bound(cmpr.begin(), cmpr.end(), D);
    if(it == cmpr.end()) return 1;
    int d = mp[*it];

    int ans = psLR.sum(ndLR[d], L, R);
    if(ans == 0){
        int a = psR.first_one(ndR[d], L, R), b = psL.last_one(ndL[d], L, R);
        if(a != -1 && b != -1 && a < b) return 2;
        return 1;
    }

    int a = psLR.first_one(ndLR[d], L, R), b = psLR.last_one(ndLR[d], L, R);
    if(psR.sum(ndR[d], L, a-1) > 0) ans++;
    if(psL.sum(ndL[d], b+1, R) > 0) ans++;

    return ans;
}

Compilation message

towers.cpp: In function 'void init(int, std::vector<int>)':
towers.cpp:157:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  157 |     for(int i = 0; i < cmpr.size(); i++) mp[cmpr[i]] = i;
      |                    ~~^~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 691 ms 120972 KB Output is correct
2 Correct 1591 ms 216080 KB Output is correct
3 Correct 1379 ms 216100 KB Output is correct
4 Correct 1185 ms 208684 KB Output is correct
5 Correct 1258 ms 208664 KB Output is correct
6 Correct 1231 ms 216160 KB Output is correct
7 Correct 1307 ms 208748 KB Output is correct
8 Correct 0 ms 208 KB Output is correct
9 Correct 6 ms 3280 KB Output is correct
10 Correct 5 ms 3164 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 848 KB Output is correct
2 Correct 5 ms 3340 KB Output is correct
3 Correct 5 ms 3280 KB Output is correct
4 Correct 5 ms 3280 KB Output is correct
5 Correct 6 ms 3280 KB Output is correct
6 Correct 6 ms 3280 KB Output is correct
7 Correct 6 ms 3280 KB Output is correct
8 Correct 5 ms 3160 KB Output is correct
9 Correct 5 ms 3168 KB Output is correct
10 Correct 5 ms 3280 KB Output is correct
11 Correct 5 ms 3280 KB Output is correct
12 Correct 0 ms 208 KB Output is correct
13 Correct 5 ms 3332 KB Output is correct
14 Correct 4 ms 3152 KB Output is correct
15 Correct 5 ms 3308 KB Output is correct
16 Correct 5 ms 3356 KB Output is correct
17 Correct 5 ms 3272 KB Output is correct
18 Correct 4 ms 3152 KB Output is correct
19 Correct 5 ms 3280 KB Output is correct
20 Correct 6 ms 3308 KB Output is correct
21 Correct 7 ms 3280 KB Output is correct
22 Correct 5 ms 3280 KB Output is correct
23 Correct 6 ms 3112 KB Output is correct
24 Correct 4 ms 3152 KB Output is correct
25 Correct 2 ms 1488 KB Output is correct
26 Correct 5 ms 3280 KB Output is correct
27 Correct 6 ms 3352 KB Output is correct
28 Correct 5 ms 3280 KB Output is correct
29 Correct 6 ms 3280 KB Output is correct
30 Correct 5 ms 3280 KB Output is correct
31 Correct 5 ms 3280 KB Output is correct
32 Correct 4 ms 3152 KB Output is correct
33 Correct 5 ms 3152 KB Output is correct
34 Correct 5 ms 3228 KB Output is correct
35 Correct 6 ms 3280 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 848 KB Output is correct
2 Correct 5 ms 3340 KB Output is correct
3 Correct 5 ms 3280 KB Output is correct
4 Correct 5 ms 3280 KB Output is correct
5 Correct 6 ms 3280 KB Output is correct
6 Correct 6 ms 3280 KB Output is correct
7 Correct 6 ms 3280 KB Output is correct
8 Correct 5 ms 3160 KB Output is correct
9 Correct 5 ms 3168 KB Output is correct
10 Correct 5 ms 3280 KB Output is correct
11 Correct 5 ms 3280 KB Output is correct
12 Correct 0 ms 208 KB Output is correct
13 Correct 5 ms 3332 KB Output is correct
14 Correct 4 ms 3152 KB Output is correct
15 Correct 5 ms 3308 KB Output is correct
16 Correct 5 ms 3356 KB Output is correct
17 Correct 5 ms 3272 KB Output is correct
18 Correct 4 ms 3152 KB Output is correct
19 Correct 5 ms 3280 KB Output is correct
20 Correct 6 ms 3308 KB Output is correct
21 Correct 7 ms 3280 KB Output is correct
22 Correct 5 ms 3280 KB Output is correct
23 Correct 6 ms 3112 KB Output is correct
24 Correct 4 ms 3152 KB Output is correct
25 Correct 2 ms 1488 KB Output is correct
26 Correct 5 ms 3280 KB Output is correct
27 Correct 6 ms 3352 KB Output is correct
28 Correct 5 ms 3280 KB Output is correct
29 Correct 6 ms 3280 KB Output is correct
30 Correct 5 ms 3280 KB Output is correct
31 Correct 5 ms 3280 KB Output is correct
32 Correct 4 ms 3152 KB Output is correct
33 Correct 5 ms 3152 KB Output is correct
34 Correct 5 ms 3228 KB Output is correct
35 Correct 6 ms 3280 KB Output is correct
36 Correct 249 ms 130616 KB Output is correct
37 Correct 410 ms 216036 KB Output is correct
38 Correct 418 ms 215952 KB Output is correct
39 Correct 443 ms 216052 KB Output is correct
40 Correct 498 ms 215924 KB Output is correct
41 Correct 422 ms 216024 KB Output is correct
42 Correct 410 ms 215940 KB Output is correct
43 Correct 241 ms 208788 KB Output is correct
44 Correct 245 ms 208800 KB Output is correct
45 Correct 279 ms 212536 KB Output is correct
46 Correct 281 ms 211944 KB Output is correct
47 Correct 402 ms 216188 KB Output is correct
48 Correct 413 ms 216080 KB Output is correct
49 Correct 421 ms 215960 KB Output is correct
50 Correct 238 ms 208692 KB Output is correct
51 Correct 246 ms 208888 KB Output is correct
52 Correct 419 ms 215964 KB Output is correct
53 Correct 413 ms 215868 KB Output is correct
54 Correct 419 ms 215952 KB Output is correct
55 Correct 255 ms 208664 KB Output is correct
56 Correct 291 ms 213080 KB Output is correct
57 Correct 395 ms 209592 KB Output is correct
58 Correct 428 ms 215988 KB Output is correct
59 Correct 411 ms 216032 KB Output is correct
60 Correct 423 ms 216048 KB Output is correct
61 Correct 435 ms 216020 KB Output is correct
62 Correct 412 ms 215996 KB Output is correct
63 Correct 416 ms 215980 KB Output is correct
64 Correct 251 ms 208696 KB Output is correct
65 Correct 240 ms 208716 KB Output is correct
66 Correct 280 ms 213892 KB Output is correct
67 Correct 253 ms 209136 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1325 ms 214740 KB Output is correct
2 Correct 1597 ms 216052 KB Output is correct
3 Correct 1478 ms 216064 KB Output is correct
4 Correct 1541 ms 215968 KB Output is correct
5 Correct 1538 ms 215876 KB Output is correct
6 Correct 1599 ms 215956 KB Output is correct
7 Correct 1346 ms 215992 KB Output is correct
8 Correct 1124 ms 208656 KB Output is correct
9 Correct 1226 ms 208764 KB Output is correct
10 Correct 1154 ms 211108 KB Output is correct
11 Correct 1387 ms 212880 KB Output is correct
12 Correct 1169 ms 216184 KB Output is correct
13 Correct 1312 ms 208744 KB Output is correct
14 Correct 0 ms 208 KB Output is correct
15 Correct 5 ms 3280 KB Output is correct
16 Correct 4 ms 3152 KB Output is correct
17 Correct 412 ms 216008 KB Output is correct
18 Correct 473 ms 215956 KB Output is correct
19 Correct 433 ms 215996 KB Output is correct
20 Correct 245 ms 208644 KB Output is correct
21 Correct 246 ms 208800 KB Output is correct
22 Correct 430 ms 215980 KB Output is correct
23 Correct 447 ms 215992 KB Output is correct
24 Correct 444 ms 215884 KB Output is correct
25 Correct 272 ms 208736 KB Output is correct
26 Correct 341 ms 213160 KB Output is correct
27 Correct 5 ms 3280 KB Output is correct
28 Correct 7 ms 3280 KB Output is correct
29 Correct 5 ms 3280 KB Output is correct
30 Correct 5 ms 3152 KB Output is correct
31 Correct 5 ms 3176 KB Output is correct
32 Correct 6 ms 3280 KB Output is correct
33 Correct 5 ms 3280 KB Output is correct
34 Correct 6 ms 3280 KB Output is correct
35 Correct 4 ms 3152 KB Output is correct
36 Correct 8 ms 3232 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 444 ms 47556 KB Output is correct
2 Correct 1547 ms 215952 KB Output is correct
3 Correct 1677 ms 215976 KB Output is correct
4 Correct 1446 ms 215916 KB Output is correct
5 Correct 1587 ms 215976 KB Output is correct
6 Correct 1584 ms 215868 KB Output is correct
7 Correct 1582 ms 215952 KB Output is correct
8 Correct 1163 ms 208704 KB Output is correct
9 Correct 1155 ms 208656 KB Output is correct
10 Correct 1170 ms 213656 KB Output is correct
11 Correct 1201 ms 214804 KB Output is correct
12 Correct 407 ms 216012 KB Output is correct
13 Correct 418 ms 215988 KB Output is correct
14 Correct 421 ms 215952 KB Output is correct
15 Correct 247 ms 208672 KB Output is correct
16 Correct 275 ms 213208 KB Output is correct
17 Correct 401 ms 209588 KB Output is correct
18 Correct 495 ms 216212 KB Output is correct
19 Correct 460 ms 216048 KB Output is correct
20 Correct 477 ms 216084 KB Output is correct
21 Correct 503 ms 216020 KB Output is correct
22 Correct 405 ms 216028 KB Output is correct
23 Correct 418 ms 215868 KB Output is correct
24 Correct 239 ms 208640 KB Output is correct
25 Correct 246 ms 208764 KB Output is correct
26 Correct 277 ms 213820 KB Output is correct
27 Correct 251 ms 209124 KB Output is correct
28 Correct 5 ms 3280 KB Output is correct
29 Correct 5 ms 3280 KB Output is correct
30 Correct 5 ms 3280 KB Output is correct
31 Correct 4 ms 3152 KB Output is correct
32 Correct 4 ms 3152 KB Output is correct
33 Correct 3 ms 1488 KB Output is correct
34 Correct 7 ms 3252 KB Output is correct
35 Correct 6 ms 3280 KB Output is correct
36 Correct 5 ms 3280 KB Output is correct
37 Correct 6 ms 3312 KB Output is correct
38 Correct 5 ms 3280 KB Output is correct
39 Correct 5 ms 3280 KB Output is correct
40 Correct 4 ms 3152 KB Output is correct
41 Correct 5 ms 3152 KB Output is correct
42 Correct 4 ms 3180 KB Output is correct
43 Correct 6 ms 3220 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 848 KB Output is correct
2 Correct 5 ms 3340 KB Output is correct
3 Correct 5 ms 3280 KB Output is correct
4 Correct 5 ms 3280 KB Output is correct
5 Correct 6 ms 3280 KB Output is correct
6 Correct 6 ms 3280 KB Output is correct
7 Correct 6 ms 3280 KB Output is correct
8 Correct 5 ms 3160 KB Output is correct
9 Correct 5 ms 3168 KB Output is correct
10 Correct 5 ms 3280 KB Output is correct
11 Correct 5 ms 3280 KB Output is correct
12 Correct 0 ms 208 KB Output is correct
13 Correct 5 ms 3332 KB Output is correct
14 Correct 4 ms 3152 KB Output is correct
15 Correct 5 ms 3308 KB Output is correct
16 Correct 5 ms 3356 KB Output is correct
17 Correct 5 ms 3272 KB Output is correct
18 Correct 4 ms 3152 KB Output is correct
19 Correct 5 ms 3280 KB Output is correct
20 Correct 6 ms 3308 KB Output is correct
21 Correct 7 ms 3280 KB Output is correct
22 Correct 5 ms 3280 KB Output is correct
23 Correct 6 ms 3112 KB Output is correct
24 Correct 4 ms 3152 KB Output is correct
25 Correct 2 ms 1488 KB Output is correct
26 Correct 5 ms 3280 KB Output is correct
27 Correct 6 ms 3352 KB Output is correct
28 Correct 5 ms 3280 KB Output is correct
29 Correct 6 ms 3280 KB Output is correct
30 Correct 5 ms 3280 KB Output is correct
31 Correct 5 ms 3280 KB Output is correct
32 Correct 4 ms 3152 KB Output is correct
33 Correct 5 ms 3152 KB Output is correct
34 Correct 5 ms 3228 KB Output is correct
35 Correct 6 ms 3280 KB Output is correct
36 Correct 249 ms 130616 KB Output is correct
37 Correct 410 ms 216036 KB Output is correct
38 Correct 418 ms 215952 KB Output is correct
39 Correct 443 ms 216052 KB Output is correct
40 Correct 498 ms 215924 KB Output is correct
41 Correct 422 ms 216024 KB Output is correct
42 Correct 410 ms 215940 KB Output is correct
43 Correct 241 ms 208788 KB Output is correct
44 Correct 245 ms 208800 KB Output is correct
45 Correct 279 ms 212536 KB Output is correct
46 Correct 281 ms 211944 KB Output is correct
47 Correct 402 ms 216188 KB Output is correct
48 Correct 413 ms 216080 KB Output is correct
49 Correct 421 ms 215960 KB Output is correct
50 Correct 238 ms 208692 KB Output is correct
51 Correct 246 ms 208888 KB Output is correct
52 Correct 419 ms 215964 KB Output is correct
53 Correct 413 ms 215868 KB Output is correct
54 Correct 419 ms 215952 KB Output is correct
55 Correct 255 ms 208664 KB Output is correct
56 Correct 291 ms 213080 KB Output is correct
57 Correct 395 ms 209592 KB Output is correct
58 Correct 428 ms 215988 KB Output is correct
59 Correct 411 ms 216032 KB Output is correct
60 Correct 423 ms 216048 KB Output is correct
61 Correct 435 ms 216020 KB Output is correct
62 Correct 412 ms 215996 KB Output is correct
63 Correct 416 ms 215980 KB Output is correct
64 Correct 251 ms 208696 KB Output is correct
65 Correct 240 ms 208716 KB Output is correct
66 Correct 280 ms 213892 KB Output is correct
67 Correct 253 ms 209136 KB Output is correct
68 Correct 1325 ms 214740 KB Output is correct
69 Correct 1597 ms 216052 KB Output is correct
70 Correct 1478 ms 216064 KB Output is correct
71 Correct 1541 ms 215968 KB Output is correct
72 Correct 1538 ms 215876 KB Output is correct
73 Correct 1599 ms 215956 KB Output is correct
74 Correct 1346 ms 215992 KB Output is correct
75 Correct 1124 ms 208656 KB Output is correct
76 Correct 1226 ms 208764 KB Output is correct
77 Correct 1154 ms 211108 KB Output is correct
78 Correct 1387 ms 212880 KB Output is correct
79 Correct 1169 ms 216184 KB Output is correct
80 Correct 1312 ms 208744 KB Output is correct
81 Correct 0 ms 208 KB Output is correct
82 Correct 5 ms 3280 KB Output is correct
83 Correct 4 ms 3152 KB Output is correct
84 Correct 412 ms 216008 KB Output is correct
85 Correct 473 ms 215956 KB Output is correct
86 Correct 433 ms 215996 KB Output is correct
87 Correct 245 ms 208644 KB Output is correct
88 Correct 246 ms 208800 KB Output is correct
89 Correct 430 ms 215980 KB Output is correct
90 Correct 447 ms 215992 KB Output is correct
91 Correct 444 ms 215884 KB Output is correct
92 Correct 272 ms 208736 KB Output is correct
93 Correct 341 ms 213160 KB Output is correct
94 Correct 5 ms 3280 KB Output is correct
95 Correct 7 ms 3280 KB Output is correct
96 Correct 5 ms 3280 KB Output is correct
97 Correct 5 ms 3152 KB Output is correct
98 Correct 5 ms 3176 KB Output is correct
99 Correct 6 ms 3280 KB Output is correct
100 Correct 5 ms 3280 KB Output is correct
101 Correct 6 ms 3280 KB Output is correct
102 Correct 4 ms 3152 KB Output is correct
103 Correct 8 ms 3232 KB Output is correct
104 Correct 1258 ms 194648 KB Output is correct
105 Correct 1584 ms 216024 KB Output is correct
106 Correct 1630 ms 215976 KB Output is correct
107 Correct 1459 ms 215872 KB Output is correct
108 Correct 1450 ms 216032 KB Output is correct
109 Correct 1443 ms 216076 KB Output is correct
110 Correct 1595 ms 216204 KB Output is correct
111 Correct 1256 ms 208704 KB Output is correct
112 Correct 1199 ms 208704 KB Output is correct
113 Correct 1000 ms 214776 KB Output is correct
114 Correct 1348 ms 212672 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 691 ms 120972 KB Output is correct
2 Correct 1591 ms 216080 KB Output is correct
3 Correct 1379 ms 216100 KB Output is correct
4 Correct 1185 ms 208684 KB Output is correct
5 Correct 1258 ms 208664 KB Output is correct
6 Correct 1231 ms 216160 KB Output is correct
7 Correct 1307 ms 208748 KB Output is correct
8 Correct 0 ms 208 KB Output is correct
9 Correct 6 ms 3280 KB Output is correct
10 Correct 5 ms 3164 KB Output is correct
11 Correct 1 ms 848 KB Output is correct
12 Correct 5 ms 3340 KB Output is correct
13 Correct 5 ms 3280 KB Output is correct
14 Correct 5 ms 3280 KB Output is correct
15 Correct 6 ms 3280 KB Output is correct
16 Correct 6 ms 3280 KB Output is correct
17 Correct 6 ms 3280 KB Output is correct
18 Correct 5 ms 3160 KB Output is correct
19 Correct 5 ms 3168 KB Output is correct
20 Correct 5 ms 3280 KB Output is correct
21 Correct 5 ms 3280 KB Output is correct
22 Correct 0 ms 208 KB Output is correct
23 Correct 5 ms 3332 KB Output is correct
24 Correct 4 ms 3152 KB Output is correct
25 Correct 5 ms 3308 KB Output is correct
26 Correct 5 ms 3356 KB Output is correct
27 Correct 5 ms 3272 KB Output is correct
28 Correct 4 ms 3152 KB Output is correct
29 Correct 5 ms 3280 KB Output is correct
30 Correct 6 ms 3308 KB Output is correct
31 Correct 7 ms 3280 KB Output is correct
32 Correct 5 ms 3280 KB Output is correct
33 Correct 6 ms 3112 KB Output is correct
34 Correct 4 ms 3152 KB Output is correct
35 Correct 2 ms 1488 KB Output is correct
36 Correct 5 ms 3280 KB Output is correct
37 Correct 6 ms 3352 KB Output is correct
38 Correct 5 ms 3280 KB Output is correct
39 Correct 6 ms 3280 KB Output is correct
40 Correct 5 ms 3280 KB Output is correct
41 Correct 5 ms 3280 KB Output is correct
42 Correct 4 ms 3152 KB Output is correct
43 Correct 5 ms 3152 KB Output is correct
44 Correct 5 ms 3228 KB Output is correct
45 Correct 6 ms 3280 KB Output is correct
46 Correct 249 ms 130616 KB Output is correct
47 Correct 410 ms 216036 KB Output is correct
48 Correct 418 ms 215952 KB Output is correct
49 Correct 443 ms 216052 KB Output is correct
50 Correct 498 ms 215924 KB Output is correct
51 Correct 422 ms 216024 KB Output is correct
52 Correct 410 ms 215940 KB Output is correct
53 Correct 241 ms 208788 KB Output is correct
54 Correct 245 ms 208800 KB Output is correct
55 Correct 279 ms 212536 KB Output is correct
56 Correct 281 ms 211944 KB Output is correct
57 Correct 402 ms 216188 KB Output is correct
58 Correct 413 ms 216080 KB Output is correct
59 Correct 421 ms 215960 KB Output is correct
60 Correct 238 ms 208692 KB Output is correct
61 Correct 246 ms 208888 KB Output is correct
62 Correct 419 ms 215964 KB Output is correct
63 Correct 413 ms 215868 KB Output is correct
64 Correct 419 ms 215952 KB Output is correct
65 Correct 255 ms 208664 KB Output is correct
66 Correct 291 ms 213080 KB Output is correct
67 Correct 395 ms 209592 KB Output is correct
68 Correct 428 ms 215988 KB Output is correct
69 Correct 411 ms 216032 KB Output is correct
70 Correct 423 ms 216048 KB Output is correct
71 Correct 435 ms 216020 KB Output is correct
72 Correct 412 ms 215996 KB Output is correct
73 Correct 416 ms 215980 KB Output is correct
74 Correct 251 ms 208696 KB Output is correct
75 Correct 240 ms 208716 KB Output is correct
76 Correct 280 ms 213892 KB Output is correct
77 Correct 253 ms 209136 KB Output is correct
78 Correct 1325 ms 214740 KB Output is correct
79 Correct 1597 ms 216052 KB Output is correct
80 Correct 1478 ms 216064 KB Output is correct
81 Correct 1541 ms 215968 KB Output is correct
82 Correct 1538 ms 215876 KB Output is correct
83 Correct 1599 ms 215956 KB Output is correct
84 Correct 1346 ms 215992 KB Output is correct
85 Correct 1124 ms 208656 KB Output is correct
86 Correct 1226 ms 208764 KB Output is correct
87 Correct 1154 ms 211108 KB Output is correct
88 Correct 1387 ms 212880 KB Output is correct
89 Correct 1169 ms 216184 KB Output is correct
90 Correct 1312 ms 208744 KB Output is correct
91 Correct 0 ms 208 KB Output is correct
92 Correct 5 ms 3280 KB Output is correct
93 Correct 4 ms 3152 KB Output is correct
94 Correct 412 ms 216008 KB Output is correct
95 Correct 473 ms 215956 KB Output is correct
96 Correct 433 ms 215996 KB Output is correct
97 Correct 245 ms 208644 KB Output is correct
98 Correct 246 ms 208800 KB Output is correct
99 Correct 430 ms 215980 KB Output is correct
100 Correct 447 ms 215992 KB Output is correct
101 Correct 444 ms 215884 KB Output is correct
102 Correct 272 ms 208736 KB Output is correct
103 Correct 341 ms 213160 KB Output is correct
104 Correct 5 ms 3280 KB Output is correct
105 Correct 7 ms 3280 KB Output is correct
106 Correct 5 ms 3280 KB Output is correct
107 Correct 5 ms 3152 KB Output is correct
108 Correct 5 ms 3176 KB Output is correct
109 Correct 6 ms 3280 KB Output is correct
110 Correct 5 ms 3280 KB Output is correct
111 Correct 6 ms 3280 KB Output is correct
112 Correct 4 ms 3152 KB Output is correct
113 Correct 8 ms 3232 KB Output is correct
114 Correct 444 ms 47556 KB Output is correct
115 Correct 1547 ms 215952 KB Output is correct
116 Correct 1677 ms 215976 KB Output is correct
117 Correct 1446 ms 215916 KB Output is correct
118 Correct 1587 ms 215976 KB Output is correct
119 Correct 1584 ms 215868 KB Output is correct
120 Correct 1582 ms 215952 KB Output is correct
121 Correct 1163 ms 208704 KB Output is correct
122 Correct 1155 ms 208656 KB Output is correct
123 Correct 1170 ms 213656 KB Output is correct
124 Correct 1201 ms 214804 KB Output is correct
125 Correct 407 ms 216012 KB Output is correct
126 Correct 418 ms 215988 KB Output is correct
127 Correct 421 ms 215952 KB Output is correct
128 Correct 247 ms 208672 KB Output is correct
129 Correct 275 ms 213208 KB Output is correct
130 Correct 401 ms 209588 KB Output is correct
131 Correct 495 ms 216212 KB Output is correct
132 Correct 460 ms 216048 KB Output is correct
133 Correct 477 ms 216084 KB Output is correct
134 Correct 503 ms 216020 KB Output is correct
135 Correct 405 ms 216028 KB Output is correct
136 Correct 418 ms 215868 KB Output is correct
137 Correct 239 ms 208640 KB Output is correct
138 Correct 246 ms 208764 KB Output is correct
139 Correct 277 ms 213820 KB Output is correct
140 Correct 251 ms 209124 KB Output is correct
141 Correct 5 ms 3280 KB Output is correct
142 Correct 5 ms 3280 KB Output is correct
143 Correct 5 ms 3280 KB Output is correct
144 Correct 4 ms 3152 KB Output is correct
145 Correct 4 ms 3152 KB Output is correct
146 Correct 3 ms 1488 KB Output is correct
147 Correct 7 ms 3252 KB Output is correct
148 Correct 6 ms 3280 KB Output is correct
149 Correct 5 ms 3280 KB Output is correct
150 Correct 6 ms 3312 KB Output is correct
151 Correct 5 ms 3280 KB Output is correct
152 Correct 5 ms 3280 KB Output is correct
153 Correct 4 ms 3152 KB Output is correct
154 Correct 5 ms 3152 KB Output is correct
155 Correct 4 ms 3180 KB Output is correct
156 Correct 6 ms 3220 KB Output is correct
157 Correct 1258 ms 194648 KB Output is correct
158 Correct 1584 ms 216024 KB Output is correct
159 Correct 1630 ms 215976 KB Output is correct
160 Correct 1459 ms 215872 KB Output is correct
161 Correct 1450 ms 216032 KB Output is correct
162 Correct 1443 ms 216076 KB Output is correct
163 Correct 1595 ms 216204 KB Output is correct
164 Correct 1256 ms 208704 KB Output is correct
165 Correct 1199 ms 208704 KB Output is correct
166 Correct 1000 ms 214776 KB Output is correct
167 Correct 1348 ms 212672 KB Output is correct
168 Correct 1 ms 208 KB Output is correct
169 Correct 1014 ms 75788 KB Output is correct
170 Correct 1905 ms 216012 KB Output is correct
171 Correct 1926 ms 216076 KB Output is correct
172 Correct 1856 ms 215892 KB Output is correct
173 Correct 1735 ms 215936 KB Output is correct
174 Correct 1952 ms 215996 KB Output is correct
175 Correct 1772 ms 215976 KB Output is correct
176 Correct 1186 ms 208632 KB Output is correct
177 Correct 1126 ms 208704 KB Output is correct
178 Correct 1283 ms 215372 KB Output is correct
179 Correct 1317 ms 212880 KB Output is correct