답안 #723069

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
723069 2023-04-13T08:15:51 Z josanneo22 송신탑 (IOI22_towers) C++17
100 / 100
1588 ms 51392 KB
#include "towers.h"
#include <bits/stdc++.h>
 
using namespace std;
typedef long long ll;
int n, a[100100], b[100100], typ[100100];
vector<int> T;
 
struct Node{
    int x, l, r;
    Node(){}
    Node(int _x, int _l, int _r): x(_x), l(_l), r(_r) {}
};
struct PST{
    Node tree[4004000];
    int root[100100], pt1, pt2, sz;
    void init(int n){
        sz = n;
        tree[0] = Node(0, -1, -1);
        root[0] = 0;
        pt1 = 1, pt2 = 1;
    }
    void add(){
        tree[pt1] = tree[root[pt2-1]];
        root[pt2] = pt1;
        ++pt1, ++pt2;
    }
    int _new(int i){
        if (i!=-1) tree[pt1++] = tree[i];
        else tree[pt1++] = Node(0, -1, -1);
        return pt1-1;
    }
    void build(int i, int l, int r, int a[]){
        if (l==r) {tree[i].x = a[l]; return;}
        int m = (l+r)>>1;
 
        tree[i].l = _new(tree[i].l);
        tree[i].r = _new(tree[i].r);
        build(tree[i].l, l, m, a); build(tree[i].r, m+1, r, a);
        tree[i].x = tree[tree[i].l].x + tree[tree[i].r].x;
    }
    void update(int i, int l, int r, int s, int x){
        if (r<s || s<l) return;
        if (l==r) {tree[i].x = x; return;}
        int m = (l+r)>>1;
 
        tree[i].l = _new(tree[i].l);
        tree[i].r = _new(tree[i].r);
        update(tree[i].l, l, m, s, x); update(tree[i].r, m+1, r, s, x);
        tree[i].x = tree[tree[i].l].x + tree[tree[i].r].x;
    }
    int query(int i, int l, int r, int s, int e){
        if (i==-1) return 0;
        if (r<s || e<l) return 0;
        if (s<=l && r<=e) return tree[i].x;
 
        int m = (l+r)>>1;
        return query(tree[i].l, l, m, s, e) + query(tree[i].r, m+1, r, s, e);
    }
    int left_bound(int i, int l, int r, int s, int e){
        if (r<s || e<l) return -1;
        if (tree[i].x==0) return -1;
        if (l==r) return l;
 
        int m = (l+r)>>1;
        int tmp = left_bound(tree[i].l, l, m, s, e);
        if (tmp!=-1) return tmp;
        return left_bound(tree[i].r, m+1, r, s, e);
    }
    int right_bound(int i, int l, int r, int s, int e){
        if (r<s || e<l) return -1;
        if (tree[i].x==0) return -1;
        if (l==r) return l;
 
        int m = (l+r)>>1;
        int tmp = right_bound(tree[i].r, m+1, r, s, e);
        if (tmp!=-1) return tmp;
        return right_bound(tree[i].l, l, m, s, e);
    }
 
    void update(int s, int x){
        update(root[pt2-1], 1, sz, s, x);
    }
    int query(int t, int l, int r){
        return query(root[t], 1, sz, l, r);
    }
    int left_bound(int t, int l, int r){
        return left_bound(root[t], 1, sz, l, r);
    }
    int right_bound(int t, int l, int r){
        return right_bound(root[t], 1, sz, l, r);
    }
}tree1;
 
struct Seg{
    int tree[200200], sz;
    void init(int n){
        sz = n;
        for (int i=sz;i<sz*2;i++) tree[i] = a[i-sz];
        for (int i=sz-1;i;i--) tree[i] = min(tree[i<<1], tree[i<<1|1]);
    }
    int query(int l, int r){
        ++r;
        int ret = 1e9;
        for (l+=sz, r+=sz;l<r;l>>=1, r>>=1){
            if (l&1) ret = min(ret, tree[l++]);
            if (r&1) ret = min(ret, tree[--r]);
        }
        return ret;
    }
}tree2;
 
set<int> st;
priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>> pq;
 
int myabs(int x){
    if (x<0) return -x;
    return x;
}
 
int getd(int x){
    auto iter = st.find(x);
    if (iter==st.end() || next(iter)==st.end()) return -1;
    return myabs(a[*next(iter)] - a[*iter]);
}
 
void init(int N, std::vector<int> H) {
    n = N;
    for (int i=1;i<=n;i++) a[i] = H[i-1];
 
    int tl = 1, tr = n;
    for (;tl<n;tl++) if (a[tl] < a[tl+1]) break;
    for (;tr>1;tr--) if (a[tr-1] > a[tr]) break;
    assert(tl<=tr);
 
    st.insert(tl);
    st.insert(tr);
    b[tl] = b[tr] = 1;
    typ[tl] = typ[tr] = -1;
    for (int i=tl+1;i<tr;i++){
        if (a[i-1] < a[i] && a[i] > a[i+1]){
            b[i] = 1, typ[i] = 1;
            st.insert(i);
        }
        if (a[i-1] > a[i] && a[i] < a[i+1]){
            b[i] = 1, typ[i] = -1;
            st.insert(i);
        }
    }
 
    for (auto iter=st.begin();next(iter)!=st.end();iter++) pq.emplace(myabs(a[*next(iter)] - a[*iter]), *iter);
 
    tree1.init(n);
    tree1.build(0, 1, n, b);
    tree2.init(n+1);
    T.push_back(0);
 
    while(!pq.empty()){
        auto [d, i] = pq.top(); pq.pop();
        if (getd(i)!=d) continue;
 
        auto iter = st.find(i);
        T.push_back(d);
        tree1.add();
        tree1.update(i, 0);
        tree1.update(*next(iter), 0);
        iter = st.erase(iter, next(next(iter)));
 
        //for (auto &x:st) printf(" %d", x);
        //printf("\n");
 
        if (iter==st.begin() || iter==st.end()) continue;
        //printf(" add: %d %d -> %d\n", *prev(iter), *iter, getd(*prev(iter)));
        --iter;
        pq.emplace(myabs(a[*next(iter)] - a[*iter]), *iter);
    }
 
    /*for (int i=1;i<=n;i++) printf("%d ", b[i]);
    printf("\n");
    for (int i=1;i<=n;i++) printf("%d ", typ[i]);
    printf("\n");
    for (auto &x:T) printf("%d ", x);
    printf("\n");*/
 
    //printf("%d\n", tree1.tree[0].x);
}
 
int max_towers(int l, int r, int D) {
    ++l, ++r;
    int t = lower_bound(T.begin(), T.end(), D) - T.begin() - 1;
    int ans = tree1.query(t, l, r);
    //printf("%d -> ", ans);
    if (ans==0) return 1;
 
    int L = tree1.left_bound(t, l, r), R = tree1.right_bound(t, l, r);
    assert(L!=-1);
    assert(R!=-1);
 
    if (typ[L]==1){
        int tmp = tree2.query(l, L-1);
        if (a[L] - tmp >= D) ans++;
        else ans--;
    }
    if (ans==0) return 1;
    if (typ[R]==1){
        int tmp  = tree2.query(R+1, r);
        if (a[R] - tmp >= D) ans++;
        else ans--;
    }
 
    assert(ans%2==1);
    return (ans+1)/2;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 330 ms 2896 KB Output is correct
2 Correct 960 ms 4560 KB Output is correct
3 Correct 920 ms 4532 KB Output is correct
4 Correct 921 ms 4528 KB Output is correct
5 Correct 909 ms 4520 KB Output is correct
6 Correct 997 ms 4580 KB Output is correct
7 Correct 917 ms 4536 KB Output is correct
8 Correct 0 ms 208 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 2 ms 848 KB Output is correct
3 Correct 2 ms 848 KB Output is correct
4 Correct 3 ms 976 KB Output is correct
5 Correct 3 ms 976 KB Output is correct
6 Correct 4 ms 976 KB Output is correct
7 Correct 2 ms 976 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 1 ms 336 KB Output is correct
12 Correct 0 ms 208 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 1 ms 304 KB Output is correct
15 Correct 2 ms 848 KB Output is correct
16 Correct 2 ms 1088 KB Output is correct
17 Correct 2 ms 976 KB Output is correct
18 Correct 1 ms 336 KB Output is correct
19 Correct 1 ms 404 KB Output is correct
20 Correct 3 ms 848 KB Output is correct
21 Correct 3 ms 972 KB Output is correct
22 Correct 3 ms 976 KB Output is correct
23 Correct 1 ms 336 KB Output is correct
24 Correct 1 ms 304 KB Output is correct
25 Correct 1 ms 464 KB Output is correct
26 Correct 2 ms 848 KB Output is correct
27 Correct 2 ms 848 KB Output is correct
28 Correct 2 ms 976 KB Output is correct
29 Correct 2 ms 1036 KB Output is correct
30 Correct 3 ms 976 KB Output is correct
31 Correct 2 ms 1072 KB Output is correct
32 Correct 1 ms 336 KB Output is correct
33 Correct 1 ms 336 KB Output is correct
34 Correct 1 ms 336 KB Output is correct
35 Correct 1 ms 336 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 2 ms 848 KB Output is correct
3 Correct 2 ms 848 KB Output is correct
4 Correct 3 ms 976 KB Output is correct
5 Correct 3 ms 976 KB Output is correct
6 Correct 4 ms 976 KB Output is correct
7 Correct 2 ms 976 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 1 ms 336 KB Output is correct
12 Correct 0 ms 208 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 1 ms 304 KB Output is correct
15 Correct 2 ms 848 KB Output is correct
16 Correct 2 ms 1088 KB Output is correct
17 Correct 2 ms 976 KB Output is correct
18 Correct 1 ms 336 KB Output is correct
19 Correct 1 ms 404 KB Output is correct
20 Correct 3 ms 848 KB Output is correct
21 Correct 3 ms 972 KB Output is correct
22 Correct 3 ms 976 KB Output is correct
23 Correct 1 ms 336 KB Output is correct
24 Correct 1 ms 304 KB Output is correct
25 Correct 1 ms 464 KB Output is correct
26 Correct 2 ms 848 KB Output is correct
27 Correct 2 ms 848 KB Output is correct
28 Correct 2 ms 976 KB Output is correct
29 Correct 2 ms 1036 KB Output is correct
30 Correct 3 ms 976 KB Output is correct
31 Correct 2 ms 1072 KB Output is correct
32 Correct 1 ms 336 KB Output is correct
33 Correct 1 ms 336 KB Output is correct
34 Correct 1 ms 336 KB Output is correct
35 Correct 1 ms 336 KB Output is correct
36 Correct 79 ms 22756 KB Output is correct
37 Correct 135 ms 36228 KB Output is correct
38 Correct 131 ms 35992 KB Output is correct
39 Correct 232 ms 51236 KB Output is correct
40 Correct 222 ms 51232 KB Output is correct
41 Correct 188 ms 51212 KB Output is correct
42 Correct 208 ms 51196 KB Output is correct
43 Correct 16 ms 4536 KB Output is correct
44 Correct 20 ms 4552 KB Output is correct
45 Correct 23 ms 4636 KB Output is correct
46 Correct 13 ms 4648 KB Output is correct
47 Correct 126 ms 36028 KB Output is correct
48 Correct 209 ms 51264 KB Output is correct
49 Correct 199 ms 51208 KB Output is correct
50 Correct 13 ms 4516 KB Output is correct
51 Correct 21 ms 4516 KB Output is correct
52 Correct 121 ms 36004 KB Output is correct
53 Correct 191 ms 51236 KB Output is correct
54 Correct 224 ms 51392 KB Output is correct
55 Correct 14 ms 4512 KB Output is correct
56 Correct 14 ms 4648 KB Output is correct
57 Correct 117 ms 34716 KB Output is correct
58 Correct 123 ms 36084 KB Output is correct
59 Correct 130 ms 36144 KB Output is correct
60 Correct 222 ms 51212 KB Output is correct
61 Correct 197 ms 51276 KB Output is correct
62 Correct 193 ms 51228 KB Output is correct
63 Correct 187 ms 51264 KB Output is correct
64 Correct 14 ms 4508 KB Output is correct
65 Correct 23 ms 4552 KB Output is correct
66 Correct 19 ms 4552 KB Output is correct
67 Correct 14 ms 4632 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 970 ms 35692 KB Output is correct
2 Correct 1181 ms 35968 KB Output is correct
3 Correct 1178 ms 35984 KB Output is correct
4 Correct 1245 ms 51228 KB Output is correct
5 Correct 1293 ms 51236 KB Output is correct
6 Correct 1167 ms 51188 KB Output is correct
7 Correct 1238 ms 51188 KB Output is correct
8 Correct 891 ms 4532 KB Output is correct
9 Correct 909 ms 4528 KB Output is correct
10 Correct 1064 ms 4520 KB Output is correct
11 Correct 946 ms 4636 KB Output is correct
12 Correct 969 ms 4532 KB Output is correct
13 Correct 893 ms 4520 KB Output is correct
14 Correct 1 ms 208 KB Output is correct
15 Correct 1 ms 336 KB Output is correct
16 Correct 1 ms 336 KB Output is correct
17 Correct 145 ms 35964 KB Output is correct
18 Correct 232 ms 51224 KB Output is correct
19 Correct 189 ms 51304 KB Output is correct
20 Correct 14 ms 4516 KB Output is correct
21 Correct 24 ms 4532 KB Output is correct
22 Correct 141 ms 35940 KB Output is correct
23 Correct 216 ms 51356 KB Output is correct
24 Correct 233 ms 51296 KB Output is correct
25 Correct 14 ms 4520 KB Output is correct
26 Correct 14 ms 4540 KB Output is correct
27 Correct 3 ms 848 KB Output is correct
28 Correct 2 ms 1068 KB Output is correct
29 Correct 3 ms 1076 KB Output is correct
30 Correct 1 ms 356 KB Output is correct
31 Correct 1 ms 336 KB Output is correct
32 Correct 2 ms 848 KB Output is correct
33 Correct 2 ms 976 KB Output is correct
34 Correct 3 ms 976 KB Output is correct
35 Correct 1 ms 336 KB Output is correct
36 Correct 1 ms 312 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 331 ms 8160 KB Output is correct
2 Correct 1119 ms 36056 KB Output is correct
3 Correct 1117 ms 35984 KB Output is correct
4 Correct 1280 ms 51176 KB Output is correct
5 Correct 1063 ms 51216 KB Output is correct
6 Correct 1072 ms 51392 KB Output is correct
7 Correct 1167 ms 51280 KB Output is correct
8 Correct 902 ms 4520 KB Output is correct
9 Correct 766 ms 4548 KB Output is correct
10 Correct 589 ms 4532 KB Output is correct
11 Correct 1043 ms 4552 KB Output is correct
12 Correct 123 ms 36036 KB Output is correct
13 Correct 188 ms 51244 KB Output is correct
14 Correct 226 ms 51240 KB Output is correct
15 Correct 14 ms 4540 KB Output is correct
16 Correct 15 ms 4552 KB Output is correct
17 Correct 128 ms 34664 KB Output is correct
18 Correct 134 ms 36044 KB Output is correct
19 Correct 151 ms 36140 KB Output is correct
20 Correct 283 ms 51348 KB Output is correct
21 Correct 235 ms 51192 KB Output is correct
22 Correct 213 ms 51228 KB Output is correct
23 Correct 211 ms 51224 KB Output is correct
24 Correct 14 ms 4528 KB Output is correct
25 Correct 15 ms 4516 KB Output is correct
26 Correct 25 ms 4544 KB Output is correct
27 Correct 26 ms 4540 KB Output is correct
28 Correct 2 ms 848 KB Output is correct
29 Correct 3 ms 976 KB Output is correct
30 Correct 3 ms 976 KB Output is correct
31 Correct 1 ms 336 KB Output is correct
32 Correct 2 ms 336 KB Output is correct
33 Correct 1 ms 464 KB Output is correct
34 Correct 2 ms 848 KB Output is correct
35 Correct 3 ms 848 KB Output is correct
36 Correct 3 ms 976 KB Output is correct
37 Correct 3 ms 1072 KB Output is correct
38 Correct 3 ms 976 KB Output is correct
39 Correct 3 ms 1072 KB Output is correct
40 Correct 1 ms 336 KB Output is correct
41 Correct 1 ms 336 KB Output is correct
42 Correct 1 ms 336 KB Output is correct
43 Correct 1 ms 304 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 2 ms 848 KB Output is correct
3 Correct 2 ms 848 KB Output is correct
4 Correct 3 ms 976 KB Output is correct
5 Correct 3 ms 976 KB Output is correct
6 Correct 4 ms 976 KB Output is correct
7 Correct 2 ms 976 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 1 ms 336 KB Output is correct
12 Correct 0 ms 208 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 1 ms 304 KB Output is correct
15 Correct 2 ms 848 KB Output is correct
16 Correct 2 ms 1088 KB Output is correct
17 Correct 2 ms 976 KB Output is correct
18 Correct 1 ms 336 KB Output is correct
19 Correct 1 ms 404 KB Output is correct
20 Correct 3 ms 848 KB Output is correct
21 Correct 3 ms 972 KB Output is correct
22 Correct 3 ms 976 KB Output is correct
23 Correct 1 ms 336 KB Output is correct
24 Correct 1 ms 304 KB Output is correct
25 Correct 1 ms 464 KB Output is correct
26 Correct 2 ms 848 KB Output is correct
27 Correct 2 ms 848 KB Output is correct
28 Correct 2 ms 976 KB Output is correct
29 Correct 2 ms 1036 KB Output is correct
30 Correct 3 ms 976 KB Output is correct
31 Correct 2 ms 1072 KB Output is correct
32 Correct 1 ms 336 KB Output is correct
33 Correct 1 ms 336 KB Output is correct
34 Correct 1 ms 336 KB Output is correct
35 Correct 1 ms 336 KB Output is correct
36 Correct 79 ms 22756 KB Output is correct
37 Correct 135 ms 36228 KB Output is correct
38 Correct 131 ms 35992 KB Output is correct
39 Correct 232 ms 51236 KB Output is correct
40 Correct 222 ms 51232 KB Output is correct
41 Correct 188 ms 51212 KB Output is correct
42 Correct 208 ms 51196 KB Output is correct
43 Correct 16 ms 4536 KB Output is correct
44 Correct 20 ms 4552 KB Output is correct
45 Correct 23 ms 4636 KB Output is correct
46 Correct 13 ms 4648 KB Output is correct
47 Correct 126 ms 36028 KB Output is correct
48 Correct 209 ms 51264 KB Output is correct
49 Correct 199 ms 51208 KB Output is correct
50 Correct 13 ms 4516 KB Output is correct
51 Correct 21 ms 4516 KB Output is correct
52 Correct 121 ms 36004 KB Output is correct
53 Correct 191 ms 51236 KB Output is correct
54 Correct 224 ms 51392 KB Output is correct
55 Correct 14 ms 4512 KB Output is correct
56 Correct 14 ms 4648 KB Output is correct
57 Correct 117 ms 34716 KB Output is correct
58 Correct 123 ms 36084 KB Output is correct
59 Correct 130 ms 36144 KB Output is correct
60 Correct 222 ms 51212 KB Output is correct
61 Correct 197 ms 51276 KB Output is correct
62 Correct 193 ms 51228 KB Output is correct
63 Correct 187 ms 51264 KB Output is correct
64 Correct 14 ms 4508 KB Output is correct
65 Correct 23 ms 4552 KB Output is correct
66 Correct 19 ms 4552 KB Output is correct
67 Correct 14 ms 4632 KB Output is correct
68 Correct 970 ms 35692 KB Output is correct
69 Correct 1181 ms 35968 KB Output is correct
70 Correct 1178 ms 35984 KB Output is correct
71 Correct 1245 ms 51228 KB Output is correct
72 Correct 1293 ms 51236 KB Output is correct
73 Correct 1167 ms 51188 KB Output is correct
74 Correct 1238 ms 51188 KB Output is correct
75 Correct 891 ms 4532 KB Output is correct
76 Correct 909 ms 4528 KB Output is correct
77 Correct 1064 ms 4520 KB Output is correct
78 Correct 946 ms 4636 KB Output is correct
79 Correct 969 ms 4532 KB Output is correct
80 Correct 893 ms 4520 KB Output is correct
81 Correct 1 ms 208 KB Output is correct
82 Correct 1 ms 336 KB Output is correct
83 Correct 1 ms 336 KB Output is correct
84 Correct 145 ms 35964 KB Output is correct
85 Correct 232 ms 51224 KB Output is correct
86 Correct 189 ms 51304 KB Output is correct
87 Correct 14 ms 4516 KB Output is correct
88 Correct 24 ms 4532 KB Output is correct
89 Correct 141 ms 35940 KB Output is correct
90 Correct 216 ms 51356 KB Output is correct
91 Correct 233 ms 51296 KB Output is correct
92 Correct 14 ms 4520 KB Output is correct
93 Correct 14 ms 4540 KB Output is correct
94 Correct 3 ms 848 KB Output is correct
95 Correct 2 ms 1068 KB Output is correct
96 Correct 3 ms 1076 KB Output is correct
97 Correct 1 ms 356 KB Output is correct
98 Correct 1 ms 336 KB Output is correct
99 Correct 2 ms 848 KB Output is correct
100 Correct 2 ms 976 KB Output is correct
101 Correct 3 ms 976 KB Output is correct
102 Correct 1 ms 336 KB Output is correct
103 Correct 1 ms 312 KB Output is correct
104 Correct 938 ms 31732 KB Output is correct
105 Correct 1193 ms 35868 KB Output is correct
106 Correct 1219 ms 36096 KB Output is correct
107 Correct 1305 ms 51196 KB Output is correct
108 Correct 1101 ms 51232 KB Output is correct
109 Correct 1234 ms 51292 KB Output is correct
110 Correct 1227 ms 51256 KB Output is correct
111 Correct 1059 ms 4528 KB Output is correct
112 Correct 1077 ms 4528 KB Output is correct
113 Correct 1077 ms 4520 KB Output is correct
114 Correct 1008 ms 4520 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 330 ms 2896 KB Output is correct
2 Correct 960 ms 4560 KB Output is correct
3 Correct 920 ms 4532 KB Output is correct
4 Correct 921 ms 4528 KB Output is correct
5 Correct 909 ms 4520 KB Output is correct
6 Correct 997 ms 4580 KB Output is correct
7 Correct 917 ms 4536 KB Output is correct
8 Correct 0 ms 208 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 1 ms 336 KB Output is correct
12 Correct 2 ms 848 KB Output is correct
13 Correct 2 ms 848 KB Output is correct
14 Correct 3 ms 976 KB Output is correct
15 Correct 3 ms 976 KB Output is correct
16 Correct 4 ms 976 KB Output is correct
17 Correct 2 ms 976 KB Output is correct
18 Correct 1 ms 336 KB Output is correct
19 Correct 1 ms 336 KB Output is correct
20 Correct 1 ms 336 KB Output is correct
21 Correct 1 ms 336 KB Output is correct
22 Correct 0 ms 208 KB Output is correct
23 Correct 1 ms 336 KB Output is correct
24 Correct 1 ms 304 KB Output is correct
25 Correct 2 ms 848 KB Output is correct
26 Correct 2 ms 1088 KB Output is correct
27 Correct 2 ms 976 KB Output is correct
28 Correct 1 ms 336 KB Output is correct
29 Correct 1 ms 404 KB Output is correct
30 Correct 3 ms 848 KB Output is correct
31 Correct 3 ms 972 KB Output is correct
32 Correct 3 ms 976 KB Output is correct
33 Correct 1 ms 336 KB Output is correct
34 Correct 1 ms 304 KB Output is correct
35 Correct 1 ms 464 KB Output is correct
36 Correct 2 ms 848 KB Output is correct
37 Correct 2 ms 848 KB Output is correct
38 Correct 2 ms 976 KB Output is correct
39 Correct 2 ms 1036 KB Output is correct
40 Correct 3 ms 976 KB Output is correct
41 Correct 2 ms 1072 KB Output is correct
42 Correct 1 ms 336 KB Output is correct
43 Correct 1 ms 336 KB Output is correct
44 Correct 1 ms 336 KB Output is correct
45 Correct 1 ms 336 KB Output is correct
46 Correct 79 ms 22756 KB Output is correct
47 Correct 135 ms 36228 KB Output is correct
48 Correct 131 ms 35992 KB Output is correct
49 Correct 232 ms 51236 KB Output is correct
50 Correct 222 ms 51232 KB Output is correct
51 Correct 188 ms 51212 KB Output is correct
52 Correct 208 ms 51196 KB Output is correct
53 Correct 16 ms 4536 KB Output is correct
54 Correct 20 ms 4552 KB Output is correct
55 Correct 23 ms 4636 KB Output is correct
56 Correct 13 ms 4648 KB Output is correct
57 Correct 126 ms 36028 KB Output is correct
58 Correct 209 ms 51264 KB Output is correct
59 Correct 199 ms 51208 KB Output is correct
60 Correct 13 ms 4516 KB Output is correct
61 Correct 21 ms 4516 KB Output is correct
62 Correct 121 ms 36004 KB Output is correct
63 Correct 191 ms 51236 KB Output is correct
64 Correct 224 ms 51392 KB Output is correct
65 Correct 14 ms 4512 KB Output is correct
66 Correct 14 ms 4648 KB Output is correct
67 Correct 117 ms 34716 KB Output is correct
68 Correct 123 ms 36084 KB Output is correct
69 Correct 130 ms 36144 KB Output is correct
70 Correct 222 ms 51212 KB Output is correct
71 Correct 197 ms 51276 KB Output is correct
72 Correct 193 ms 51228 KB Output is correct
73 Correct 187 ms 51264 KB Output is correct
74 Correct 14 ms 4508 KB Output is correct
75 Correct 23 ms 4552 KB Output is correct
76 Correct 19 ms 4552 KB Output is correct
77 Correct 14 ms 4632 KB Output is correct
78 Correct 970 ms 35692 KB Output is correct
79 Correct 1181 ms 35968 KB Output is correct
80 Correct 1178 ms 35984 KB Output is correct
81 Correct 1245 ms 51228 KB Output is correct
82 Correct 1293 ms 51236 KB Output is correct
83 Correct 1167 ms 51188 KB Output is correct
84 Correct 1238 ms 51188 KB Output is correct
85 Correct 891 ms 4532 KB Output is correct
86 Correct 909 ms 4528 KB Output is correct
87 Correct 1064 ms 4520 KB Output is correct
88 Correct 946 ms 4636 KB Output is correct
89 Correct 969 ms 4532 KB Output is correct
90 Correct 893 ms 4520 KB Output is correct
91 Correct 1 ms 208 KB Output is correct
92 Correct 1 ms 336 KB Output is correct
93 Correct 1 ms 336 KB Output is correct
94 Correct 145 ms 35964 KB Output is correct
95 Correct 232 ms 51224 KB Output is correct
96 Correct 189 ms 51304 KB Output is correct
97 Correct 14 ms 4516 KB Output is correct
98 Correct 24 ms 4532 KB Output is correct
99 Correct 141 ms 35940 KB Output is correct
100 Correct 216 ms 51356 KB Output is correct
101 Correct 233 ms 51296 KB Output is correct
102 Correct 14 ms 4520 KB Output is correct
103 Correct 14 ms 4540 KB Output is correct
104 Correct 3 ms 848 KB Output is correct
105 Correct 2 ms 1068 KB Output is correct
106 Correct 3 ms 1076 KB Output is correct
107 Correct 1 ms 356 KB Output is correct
108 Correct 1 ms 336 KB Output is correct
109 Correct 2 ms 848 KB Output is correct
110 Correct 2 ms 976 KB Output is correct
111 Correct 3 ms 976 KB Output is correct
112 Correct 1 ms 336 KB Output is correct
113 Correct 1 ms 312 KB Output is correct
114 Correct 331 ms 8160 KB Output is correct
115 Correct 1119 ms 36056 KB Output is correct
116 Correct 1117 ms 35984 KB Output is correct
117 Correct 1280 ms 51176 KB Output is correct
118 Correct 1063 ms 51216 KB Output is correct
119 Correct 1072 ms 51392 KB Output is correct
120 Correct 1167 ms 51280 KB Output is correct
121 Correct 902 ms 4520 KB Output is correct
122 Correct 766 ms 4548 KB Output is correct
123 Correct 589 ms 4532 KB Output is correct
124 Correct 1043 ms 4552 KB Output is correct
125 Correct 123 ms 36036 KB Output is correct
126 Correct 188 ms 51244 KB Output is correct
127 Correct 226 ms 51240 KB Output is correct
128 Correct 14 ms 4540 KB Output is correct
129 Correct 15 ms 4552 KB Output is correct
130 Correct 128 ms 34664 KB Output is correct
131 Correct 134 ms 36044 KB Output is correct
132 Correct 151 ms 36140 KB Output is correct
133 Correct 283 ms 51348 KB Output is correct
134 Correct 235 ms 51192 KB Output is correct
135 Correct 213 ms 51228 KB Output is correct
136 Correct 211 ms 51224 KB Output is correct
137 Correct 14 ms 4528 KB Output is correct
138 Correct 15 ms 4516 KB Output is correct
139 Correct 25 ms 4544 KB Output is correct
140 Correct 26 ms 4540 KB Output is correct
141 Correct 2 ms 848 KB Output is correct
142 Correct 3 ms 976 KB Output is correct
143 Correct 3 ms 976 KB Output is correct
144 Correct 1 ms 336 KB Output is correct
145 Correct 2 ms 336 KB Output is correct
146 Correct 1 ms 464 KB Output is correct
147 Correct 2 ms 848 KB Output is correct
148 Correct 3 ms 848 KB Output is correct
149 Correct 3 ms 976 KB Output is correct
150 Correct 3 ms 1072 KB Output is correct
151 Correct 3 ms 976 KB Output is correct
152 Correct 3 ms 1072 KB Output is correct
153 Correct 1 ms 336 KB Output is correct
154 Correct 1 ms 336 KB Output is correct
155 Correct 1 ms 336 KB Output is correct
156 Correct 1 ms 304 KB Output is correct
157 Correct 938 ms 31732 KB Output is correct
158 Correct 1193 ms 35868 KB Output is correct
159 Correct 1219 ms 36096 KB Output is correct
160 Correct 1305 ms 51196 KB Output is correct
161 Correct 1101 ms 51232 KB Output is correct
162 Correct 1234 ms 51292 KB Output is correct
163 Correct 1227 ms 51256 KB Output is correct
164 Correct 1059 ms 4528 KB Output is correct
165 Correct 1077 ms 4528 KB Output is correct
166 Correct 1077 ms 4520 KB Output is correct
167 Correct 1008 ms 4520 KB Output is correct
168 Correct 1 ms 208 KB Output is correct
169 Correct 869 ms 11872 KB Output is correct
170 Correct 1408 ms 35864 KB Output is correct
171 Correct 1261 ms 36004 KB Output is correct
172 Correct 1239 ms 51264 KB Output is correct
173 Correct 1392 ms 51280 KB Output is correct
174 Correct 1588 ms 51228 KB Output is correct
175 Correct 1491 ms 51216 KB Output is correct
176 Correct 1153 ms 4520 KB Output is correct
177 Correct 960 ms 4528 KB Output is correct
178 Correct 968 ms 4556 KB Output is correct
179 Correct 926 ms 4532 KB Output is correct