#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 |
400 ms |
2848 KB |
Output is correct |
2 |
Correct |
637 ms |
4548 KB |
Output is correct |
3 |
Correct |
847 ms |
4520 KB |
Output is correct |
4 |
Correct |
901 ms |
4552 KB |
Output is correct |
5 |
Correct |
903 ms |
4524 KB |
Output is correct |
6 |
Correct |
944 ms |
4560 KB |
Output is correct |
7 |
Correct |
804 ms |
4516 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 |
2 ms |
976 KB |
Output is correct |
5 |
Correct |
2 ms |
976 KB |
Output is correct |
6 |
Correct |
2 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 |
336 KB |
Output is correct |
15 |
Correct |
2 ms |
848 KB |
Output is correct |
16 |
Correct |
2 ms |
976 KB |
Output is correct |
17 |
Correct |
2 ms |
1024 KB |
Output is correct |
18 |
Correct |
1 ms |
336 KB |
Output is correct |
19 |
Correct |
1 ms |
336 KB |
Output is correct |
20 |
Correct |
2 ms |
848 KB |
Output is correct |
21 |
Correct |
2 ms |
1004 KB |
Output is correct |
22 |
Correct |
2 ms |
976 KB |
Output is correct |
23 |
Correct |
1 ms |
336 KB |
Output is correct |
24 |
Correct |
1 ms |
336 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 |
976 KB |
Output is correct |
30 |
Correct |
2 ms |
976 KB |
Output is correct |
31 |
Correct |
2 ms |
976 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 |
344 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 |
2 ms |
976 KB |
Output is correct |
5 |
Correct |
2 ms |
976 KB |
Output is correct |
6 |
Correct |
2 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 |
336 KB |
Output is correct |
15 |
Correct |
2 ms |
848 KB |
Output is correct |
16 |
Correct |
2 ms |
976 KB |
Output is correct |
17 |
Correct |
2 ms |
1024 KB |
Output is correct |
18 |
Correct |
1 ms |
336 KB |
Output is correct |
19 |
Correct |
1 ms |
336 KB |
Output is correct |
20 |
Correct |
2 ms |
848 KB |
Output is correct |
21 |
Correct |
2 ms |
1004 KB |
Output is correct |
22 |
Correct |
2 ms |
976 KB |
Output is correct |
23 |
Correct |
1 ms |
336 KB |
Output is correct |
24 |
Correct |
1 ms |
336 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 |
976 KB |
Output is correct |
30 |
Correct |
2 ms |
976 KB |
Output is correct |
31 |
Correct |
2 ms |
976 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 |
344 KB |
Output is correct |
35 |
Correct |
1 ms |
336 KB |
Output is correct |
36 |
Correct |
69 ms |
22724 KB |
Output is correct |
37 |
Correct |
121 ms |
36084 KB |
Output is correct |
38 |
Correct |
113 ms |
35996 KB |
Output is correct |
39 |
Correct |
182 ms |
51488 KB |
Output is correct |
40 |
Correct |
189 ms |
51284 KB |
Output is correct |
41 |
Correct |
176 ms |
51200 KB |
Output is correct |
42 |
Correct |
186 ms |
51268 KB |
Output is correct |
43 |
Correct |
14 ms |
4516 KB |
Output is correct |
44 |
Correct |
14 ms |
4560 KB |
Output is correct |
45 |
Correct |
13 ms |
4648 KB |
Output is correct |
46 |
Correct |
13 ms |
4564 KB |
Output is correct |
47 |
Correct |
113 ms |
35932 KB |
Output is correct |
48 |
Correct |
176 ms |
51232 KB |
Output is correct |
49 |
Correct |
177 ms |
51272 KB |
Output is correct |
50 |
Correct |
16 ms |
4528 KB |
Output is correct |
51 |
Correct |
13 ms |
4528 KB |
Output is correct |
52 |
Correct |
115 ms |
36004 KB |
Output is correct |
53 |
Correct |
180 ms |
51288 KB |
Output is correct |
54 |
Correct |
177 ms |
51288 KB |
Output is correct |
55 |
Correct |
22 ms |
4536 KB |
Output is correct |
56 |
Correct |
14 ms |
4640 KB |
Output is correct |
57 |
Correct |
114 ms |
34724 KB |
Output is correct |
58 |
Correct |
119 ms |
36124 KB |
Output is correct |
59 |
Correct |
110 ms |
36128 KB |
Output is correct |
60 |
Correct |
185 ms |
51264 KB |
Output is correct |
61 |
Correct |
177 ms |
51288 KB |
Output is correct |
62 |
Correct |
181 ms |
51232 KB |
Output is correct |
63 |
Correct |
190 ms |
51252 KB |
Output is correct |
64 |
Correct |
13 ms |
4552 KB |
Output is correct |
65 |
Correct |
13 ms |
4532 KB |
Output is correct |
66 |
Correct |
13 ms |
4652 KB |
Output is correct |
67 |
Correct |
13 ms |
4568 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
802 ms |
35732 KB |
Output is correct |
2 |
Correct |
1025 ms |
35960 KB |
Output is correct |
3 |
Correct |
998 ms |
36048 KB |
Output is correct |
4 |
Correct |
974 ms |
51264 KB |
Output is correct |
5 |
Correct |
1081 ms |
51392 KB |
Output is correct |
6 |
Correct |
865 ms |
51288 KB |
Output is correct |
7 |
Correct |
901 ms |
51296 KB |
Output is correct |
8 |
Correct |
860 ms |
4524 KB |
Output is correct |
9 |
Correct |
872 ms |
4528 KB |
Output is correct |
10 |
Correct |
839 ms |
4532 KB |
Output is correct |
11 |
Correct |
874 ms |
4560 KB |
Output is correct |
12 |
Correct |
788 ms |
4552 KB |
Output is correct |
13 |
Correct |
953 ms |
4508 KB |
Output is correct |
14 |
Correct |
0 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 |
114 ms |
35956 KB |
Output is correct |
18 |
Correct |
188 ms |
51256 KB |
Output is correct |
19 |
Correct |
182 ms |
51232 KB |
Output is correct |
20 |
Correct |
14 ms |
4560 KB |
Output is correct |
21 |
Correct |
13 ms |
4540 KB |
Output is correct |
22 |
Correct |
113 ms |
36028 KB |
Output is correct |
23 |
Correct |
184 ms |
51224 KB |
Output is correct |
24 |
Correct |
196 ms |
51276 KB |
Output is correct |
25 |
Correct |
13 ms |
4536 KB |
Output is correct |
26 |
Correct |
17 ms |
4656 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 |
976 KB |
Output is correct |
30 |
Correct |
1 ms |
336 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 |
2 ms |
976 KB |
Output is correct |
35 |
Correct |
1 ms |
336 KB |
Output is correct |
36 |
Correct |
1 ms |
416 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
292 ms |
8152 KB |
Output is correct |
2 |
Correct |
1073 ms |
35992 KB |
Output is correct |
3 |
Correct |
1116 ms |
36036 KB |
Output is correct |
4 |
Correct |
1158 ms |
51264 KB |
Output is correct |
5 |
Correct |
1160 ms |
51232 KB |
Output is correct |
6 |
Correct |
1012 ms |
51264 KB |
Output is correct |
7 |
Correct |
1084 ms |
51228 KB |
Output is correct |
8 |
Correct |
897 ms |
4508 KB |
Output is correct |
9 |
Correct |
853 ms |
4520 KB |
Output is correct |
10 |
Correct |
885 ms |
4560 KB |
Output is correct |
11 |
Correct |
861 ms |
4560 KB |
Output is correct |
12 |
Correct |
113 ms |
35920 KB |
Output is correct |
13 |
Correct |
186 ms |
51172 KB |
Output is correct |
14 |
Correct |
182 ms |
51260 KB |
Output is correct |
15 |
Correct |
14 ms |
4560 KB |
Output is correct |
16 |
Correct |
13 ms |
4648 KB |
Output is correct |
17 |
Correct |
108 ms |
34684 KB |
Output is correct |
18 |
Correct |
116 ms |
36032 KB |
Output is correct |
19 |
Correct |
128 ms |
36148 KB |
Output is correct |
20 |
Correct |
190 ms |
51260 KB |
Output is correct |
21 |
Correct |
178 ms |
51264 KB |
Output is correct |
22 |
Correct |
181 ms |
51300 KB |
Output is correct |
23 |
Correct |
191 ms |
51388 KB |
Output is correct |
24 |
Correct |
22 ms |
4504 KB |
Output is correct |
25 |
Correct |
20 ms |
4528 KB |
Output is correct |
26 |
Correct |
13 ms |
4532 KB |
Output is correct |
27 |
Correct |
13 ms |
4536 KB |
Output is correct |
28 |
Correct |
2 ms |
848 KB |
Output is correct |
29 |
Correct |
3 ms |
976 KB |
Output is correct |
30 |
Correct |
2 ms |
976 KB |
Output is correct |
31 |
Correct |
1 ms |
336 KB |
Output is correct |
32 |
Correct |
1 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 |
2 ms |
848 KB |
Output is correct |
36 |
Correct |
3 ms |
976 KB |
Output is correct |
37 |
Correct |
2 ms |
976 KB |
Output is correct |
38 |
Correct |
2 ms |
1060 KB |
Output is correct |
39 |
Correct |
2 ms |
976 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 |
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 |
2 ms |
976 KB |
Output is correct |
5 |
Correct |
2 ms |
976 KB |
Output is correct |
6 |
Correct |
2 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 |
336 KB |
Output is correct |
15 |
Correct |
2 ms |
848 KB |
Output is correct |
16 |
Correct |
2 ms |
976 KB |
Output is correct |
17 |
Correct |
2 ms |
1024 KB |
Output is correct |
18 |
Correct |
1 ms |
336 KB |
Output is correct |
19 |
Correct |
1 ms |
336 KB |
Output is correct |
20 |
Correct |
2 ms |
848 KB |
Output is correct |
21 |
Correct |
2 ms |
1004 KB |
Output is correct |
22 |
Correct |
2 ms |
976 KB |
Output is correct |
23 |
Correct |
1 ms |
336 KB |
Output is correct |
24 |
Correct |
1 ms |
336 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 |
976 KB |
Output is correct |
30 |
Correct |
2 ms |
976 KB |
Output is correct |
31 |
Correct |
2 ms |
976 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 |
344 KB |
Output is correct |
35 |
Correct |
1 ms |
336 KB |
Output is correct |
36 |
Correct |
69 ms |
22724 KB |
Output is correct |
37 |
Correct |
121 ms |
36084 KB |
Output is correct |
38 |
Correct |
113 ms |
35996 KB |
Output is correct |
39 |
Correct |
182 ms |
51488 KB |
Output is correct |
40 |
Correct |
189 ms |
51284 KB |
Output is correct |
41 |
Correct |
176 ms |
51200 KB |
Output is correct |
42 |
Correct |
186 ms |
51268 KB |
Output is correct |
43 |
Correct |
14 ms |
4516 KB |
Output is correct |
44 |
Correct |
14 ms |
4560 KB |
Output is correct |
45 |
Correct |
13 ms |
4648 KB |
Output is correct |
46 |
Correct |
13 ms |
4564 KB |
Output is correct |
47 |
Correct |
113 ms |
35932 KB |
Output is correct |
48 |
Correct |
176 ms |
51232 KB |
Output is correct |
49 |
Correct |
177 ms |
51272 KB |
Output is correct |
50 |
Correct |
16 ms |
4528 KB |
Output is correct |
51 |
Correct |
13 ms |
4528 KB |
Output is correct |
52 |
Correct |
115 ms |
36004 KB |
Output is correct |
53 |
Correct |
180 ms |
51288 KB |
Output is correct |
54 |
Correct |
177 ms |
51288 KB |
Output is correct |
55 |
Correct |
22 ms |
4536 KB |
Output is correct |
56 |
Correct |
14 ms |
4640 KB |
Output is correct |
57 |
Correct |
114 ms |
34724 KB |
Output is correct |
58 |
Correct |
119 ms |
36124 KB |
Output is correct |
59 |
Correct |
110 ms |
36128 KB |
Output is correct |
60 |
Correct |
185 ms |
51264 KB |
Output is correct |
61 |
Correct |
177 ms |
51288 KB |
Output is correct |
62 |
Correct |
181 ms |
51232 KB |
Output is correct |
63 |
Correct |
190 ms |
51252 KB |
Output is correct |
64 |
Correct |
13 ms |
4552 KB |
Output is correct |
65 |
Correct |
13 ms |
4532 KB |
Output is correct |
66 |
Correct |
13 ms |
4652 KB |
Output is correct |
67 |
Correct |
13 ms |
4568 KB |
Output is correct |
68 |
Correct |
802 ms |
35732 KB |
Output is correct |
69 |
Correct |
1025 ms |
35960 KB |
Output is correct |
70 |
Correct |
998 ms |
36048 KB |
Output is correct |
71 |
Correct |
974 ms |
51264 KB |
Output is correct |
72 |
Correct |
1081 ms |
51392 KB |
Output is correct |
73 |
Correct |
865 ms |
51288 KB |
Output is correct |
74 |
Correct |
901 ms |
51296 KB |
Output is correct |
75 |
Correct |
860 ms |
4524 KB |
Output is correct |
76 |
Correct |
872 ms |
4528 KB |
Output is correct |
77 |
Correct |
839 ms |
4532 KB |
Output is correct |
78 |
Correct |
874 ms |
4560 KB |
Output is correct |
79 |
Correct |
788 ms |
4552 KB |
Output is correct |
80 |
Correct |
953 ms |
4508 KB |
Output is correct |
81 |
Correct |
0 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 |
114 ms |
35956 KB |
Output is correct |
85 |
Correct |
188 ms |
51256 KB |
Output is correct |
86 |
Correct |
182 ms |
51232 KB |
Output is correct |
87 |
Correct |
14 ms |
4560 KB |
Output is correct |
88 |
Correct |
13 ms |
4540 KB |
Output is correct |
89 |
Correct |
113 ms |
36028 KB |
Output is correct |
90 |
Correct |
184 ms |
51224 KB |
Output is correct |
91 |
Correct |
196 ms |
51276 KB |
Output is correct |
92 |
Correct |
13 ms |
4536 KB |
Output is correct |
93 |
Correct |
17 ms |
4656 KB |
Output is correct |
94 |
Correct |
2 ms |
848 KB |
Output is correct |
95 |
Correct |
2 ms |
976 KB |
Output is correct |
96 |
Correct |
2 ms |
976 KB |
Output is correct |
97 |
Correct |
1 ms |
336 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 |
2 ms |
976 KB |
Output is correct |
102 |
Correct |
1 ms |
336 KB |
Output is correct |
103 |
Correct |
1 ms |
416 KB |
Output is correct |
104 |
Correct |
918 ms |
31776 KB |
Output is correct |
105 |
Correct |
1167 ms |
35904 KB |
Output is correct |
106 |
Correct |
1053 ms |
36136 KB |
Output is correct |
107 |
Correct |
1051 ms |
51208 KB |
Output is correct |
108 |
Correct |
1121 ms |
51236 KB |
Output is correct |
109 |
Correct |
1115 ms |
51196 KB |
Output is correct |
110 |
Correct |
1106 ms |
51308 KB |
Output is correct |
111 |
Correct |
812 ms |
4540 KB |
Output is correct |
112 |
Correct |
888 ms |
4512 KB |
Output is correct |
113 |
Correct |
824 ms |
4524 KB |
Output is correct |
114 |
Correct |
762 ms |
4520 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
400 ms |
2848 KB |
Output is correct |
2 |
Correct |
637 ms |
4548 KB |
Output is correct |
3 |
Correct |
847 ms |
4520 KB |
Output is correct |
4 |
Correct |
901 ms |
4552 KB |
Output is correct |
5 |
Correct |
903 ms |
4524 KB |
Output is correct |
6 |
Correct |
944 ms |
4560 KB |
Output is correct |
7 |
Correct |
804 ms |
4516 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 |
2 ms |
976 KB |
Output is correct |
15 |
Correct |
2 ms |
976 KB |
Output is correct |
16 |
Correct |
2 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 |
336 KB |
Output is correct |
25 |
Correct |
2 ms |
848 KB |
Output is correct |
26 |
Correct |
2 ms |
976 KB |
Output is correct |
27 |
Correct |
2 ms |
1024 KB |
Output is correct |
28 |
Correct |
1 ms |
336 KB |
Output is correct |
29 |
Correct |
1 ms |
336 KB |
Output is correct |
30 |
Correct |
2 ms |
848 KB |
Output is correct |
31 |
Correct |
2 ms |
1004 KB |
Output is correct |
32 |
Correct |
2 ms |
976 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 |
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 |
976 KB |
Output is correct |
40 |
Correct |
2 ms |
976 KB |
Output is correct |
41 |
Correct |
2 ms |
976 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 |
344 KB |
Output is correct |
45 |
Correct |
1 ms |
336 KB |
Output is correct |
46 |
Correct |
69 ms |
22724 KB |
Output is correct |
47 |
Correct |
121 ms |
36084 KB |
Output is correct |
48 |
Correct |
113 ms |
35996 KB |
Output is correct |
49 |
Correct |
182 ms |
51488 KB |
Output is correct |
50 |
Correct |
189 ms |
51284 KB |
Output is correct |
51 |
Correct |
176 ms |
51200 KB |
Output is correct |
52 |
Correct |
186 ms |
51268 KB |
Output is correct |
53 |
Correct |
14 ms |
4516 KB |
Output is correct |
54 |
Correct |
14 ms |
4560 KB |
Output is correct |
55 |
Correct |
13 ms |
4648 KB |
Output is correct |
56 |
Correct |
13 ms |
4564 KB |
Output is correct |
57 |
Correct |
113 ms |
35932 KB |
Output is correct |
58 |
Correct |
176 ms |
51232 KB |
Output is correct |
59 |
Correct |
177 ms |
51272 KB |
Output is correct |
60 |
Correct |
16 ms |
4528 KB |
Output is correct |
61 |
Correct |
13 ms |
4528 KB |
Output is correct |
62 |
Correct |
115 ms |
36004 KB |
Output is correct |
63 |
Correct |
180 ms |
51288 KB |
Output is correct |
64 |
Correct |
177 ms |
51288 KB |
Output is correct |
65 |
Correct |
22 ms |
4536 KB |
Output is correct |
66 |
Correct |
14 ms |
4640 KB |
Output is correct |
67 |
Correct |
114 ms |
34724 KB |
Output is correct |
68 |
Correct |
119 ms |
36124 KB |
Output is correct |
69 |
Correct |
110 ms |
36128 KB |
Output is correct |
70 |
Correct |
185 ms |
51264 KB |
Output is correct |
71 |
Correct |
177 ms |
51288 KB |
Output is correct |
72 |
Correct |
181 ms |
51232 KB |
Output is correct |
73 |
Correct |
190 ms |
51252 KB |
Output is correct |
74 |
Correct |
13 ms |
4552 KB |
Output is correct |
75 |
Correct |
13 ms |
4532 KB |
Output is correct |
76 |
Correct |
13 ms |
4652 KB |
Output is correct |
77 |
Correct |
13 ms |
4568 KB |
Output is correct |
78 |
Correct |
802 ms |
35732 KB |
Output is correct |
79 |
Correct |
1025 ms |
35960 KB |
Output is correct |
80 |
Correct |
998 ms |
36048 KB |
Output is correct |
81 |
Correct |
974 ms |
51264 KB |
Output is correct |
82 |
Correct |
1081 ms |
51392 KB |
Output is correct |
83 |
Correct |
865 ms |
51288 KB |
Output is correct |
84 |
Correct |
901 ms |
51296 KB |
Output is correct |
85 |
Correct |
860 ms |
4524 KB |
Output is correct |
86 |
Correct |
872 ms |
4528 KB |
Output is correct |
87 |
Correct |
839 ms |
4532 KB |
Output is correct |
88 |
Correct |
874 ms |
4560 KB |
Output is correct |
89 |
Correct |
788 ms |
4552 KB |
Output is correct |
90 |
Correct |
953 ms |
4508 KB |
Output is correct |
91 |
Correct |
0 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 |
114 ms |
35956 KB |
Output is correct |
95 |
Correct |
188 ms |
51256 KB |
Output is correct |
96 |
Correct |
182 ms |
51232 KB |
Output is correct |
97 |
Correct |
14 ms |
4560 KB |
Output is correct |
98 |
Correct |
13 ms |
4540 KB |
Output is correct |
99 |
Correct |
113 ms |
36028 KB |
Output is correct |
100 |
Correct |
184 ms |
51224 KB |
Output is correct |
101 |
Correct |
196 ms |
51276 KB |
Output is correct |
102 |
Correct |
13 ms |
4536 KB |
Output is correct |
103 |
Correct |
17 ms |
4656 KB |
Output is correct |
104 |
Correct |
2 ms |
848 KB |
Output is correct |
105 |
Correct |
2 ms |
976 KB |
Output is correct |
106 |
Correct |
2 ms |
976 KB |
Output is correct |
107 |
Correct |
1 ms |
336 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 |
2 ms |
976 KB |
Output is correct |
112 |
Correct |
1 ms |
336 KB |
Output is correct |
113 |
Correct |
1 ms |
416 KB |
Output is correct |
114 |
Correct |
292 ms |
8152 KB |
Output is correct |
115 |
Correct |
1073 ms |
35992 KB |
Output is correct |
116 |
Correct |
1116 ms |
36036 KB |
Output is correct |
117 |
Correct |
1158 ms |
51264 KB |
Output is correct |
118 |
Correct |
1160 ms |
51232 KB |
Output is correct |
119 |
Correct |
1012 ms |
51264 KB |
Output is correct |
120 |
Correct |
1084 ms |
51228 KB |
Output is correct |
121 |
Correct |
897 ms |
4508 KB |
Output is correct |
122 |
Correct |
853 ms |
4520 KB |
Output is correct |
123 |
Correct |
885 ms |
4560 KB |
Output is correct |
124 |
Correct |
861 ms |
4560 KB |
Output is correct |
125 |
Correct |
113 ms |
35920 KB |
Output is correct |
126 |
Correct |
186 ms |
51172 KB |
Output is correct |
127 |
Correct |
182 ms |
51260 KB |
Output is correct |
128 |
Correct |
14 ms |
4560 KB |
Output is correct |
129 |
Correct |
13 ms |
4648 KB |
Output is correct |
130 |
Correct |
108 ms |
34684 KB |
Output is correct |
131 |
Correct |
116 ms |
36032 KB |
Output is correct |
132 |
Correct |
128 ms |
36148 KB |
Output is correct |
133 |
Correct |
190 ms |
51260 KB |
Output is correct |
134 |
Correct |
178 ms |
51264 KB |
Output is correct |
135 |
Correct |
181 ms |
51300 KB |
Output is correct |
136 |
Correct |
191 ms |
51388 KB |
Output is correct |
137 |
Correct |
22 ms |
4504 KB |
Output is correct |
138 |
Correct |
20 ms |
4528 KB |
Output is correct |
139 |
Correct |
13 ms |
4532 KB |
Output is correct |
140 |
Correct |
13 ms |
4536 KB |
Output is correct |
141 |
Correct |
2 ms |
848 KB |
Output is correct |
142 |
Correct |
3 ms |
976 KB |
Output is correct |
143 |
Correct |
2 ms |
976 KB |
Output is correct |
144 |
Correct |
1 ms |
336 KB |
Output is correct |
145 |
Correct |
1 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 |
2 ms |
848 KB |
Output is correct |
149 |
Correct |
3 ms |
976 KB |
Output is correct |
150 |
Correct |
2 ms |
976 KB |
Output is correct |
151 |
Correct |
2 ms |
1060 KB |
Output is correct |
152 |
Correct |
2 ms |
976 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 |
336 KB |
Output is correct |
157 |
Correct |
918 ms |
31776 KB |
Output is correct |
158 |
Correct |
1167 ms |
35904 KB |
Output is correct |
159 |
Correct |
1053 ms |
36136 KB |
Output is correct |
160 |
Correct |
1051 ms |
51208 KB |
Output is correct |
161 |
Correct |
1121 ms |
51236 KB |
Output is correct |
162 |
Correct |
1115 ms |
51196 KB |
Output is correct |
163 |
Correct |
1106 ms |
51308 KB |
Output is correct |
164 |
Correct |
812 ms |
4540 KB |
Output is correct |
165 |
Correct |
888 ms |
4512 KB |
Output is correct |
166 |
Correct |
824 ms |
4524 KB |
Output is correct |
167 |
Correct |
762 ms |
4520 KB |
Output is correct |
168 |
Correct |
0 ms |
336 KB |
Output is correct |
169 |
Correct |
733 ms |
11764 KB |
Output is correct |
170 |
Correct |
1178 ms |
35816 KB |
Output is correct |
171 |
Correct |
1289 ms |
36000 KB |
Output is correct |
172 |
Correct |
1367 ms |
51304 KB |
Output is correct |
173 |
Correct |
1329 ms |
51212 KB |
Output is correct |
174 |
Correct |
1219 ms |
51364 KB |
Output is correct |
175 |
Correct |
1176 ms |
51228 KB |
Output is correct |
176 |
Correct |
982 ms |
4572 KB |
Output is correct |
177 |
Correct |
853 ms |
4540 KB |
Output is correct |
178 |
Correct |
727 ms |
4608 KB |
Output is correct |
179 |
Correct |
867 ms |
4560 KB |
Output is correct |