#include "towers.h"
#include <bits/stdc++.h>
#define f first
#define s second
#define ent '\n'
using namespace std;
typedef long long ll;
const int maxn = 1e5 + 12;
int root[maxn], t[maxn * 30];
int L[maxn * 30], R[maxn * 30];
int p[20][maxn], lg[maxn];
int dp[maxn], a[maxn];
pair<int, int> ord[maxn];
map<int, int> position;
int n, nv;
int build(int l, int r){
int v = ++nv;
if(l == r) return v;
int mid = l + r >> 1;
L[v] = build(l, mid);
R[v] = build(mid+1, r);
return v;
}
int upd(int v, int tl, int tr, int pos, int x){
int u = ++nv;
if(tl == tr){
t[u] = x;
return u;
}
L[u] = L[v], R[u] = R[v];
int mid = tl + tr >> 1;
if(pos <= mid){
L[u] = upd(L[v], tl, mid, pos, x);
}
else{
R[u] = upd(R[v], mid+1, tr, pos, x);
}
t[u] = t[L[u]] + t[R[u]];
return u;
}
int get(int v, int tl, int tr, int l, int r){
if(tl > r || l > tr) return 0;
if(tl >= l && tr <= r) return t[v];
int mid = tl + tr >> 1;
return get(L[v], tl, mid, l, r) + get(R[v], mid+1, tr, l, r);
}
int get(int v, int tl, int tr, int k){
if(tl == tr) return tl;
int mid = tl + tr >> 1;
if(t[L[v]] >= k) return get(L[v], tl, mid, k);
return get(R[v], mid+1, tr, k - t[L[v]]);
}
struct asd{
int mx, mn, x, y;
} d[maxn * 4];
asd merge(asd x, asd y){
if(x.mx < 0) return y;
if(y.mx < 0) return x;
x.x = max({x.x, y.x, y.mx - x.mn});
x.y = max({x.y, y.y, x.mx - y.mn});
x.mx = max(x.mx, y.mx);
x.mn = min(x.mn, y.mn);
return x;
}
void build(int v, int tl, int tr){
if(tl == tr){
d[v].mx = d[v].mn = a[tl];
d[v].x = d[v].y = 0;
}
else{
int mid = tl + tr >> 1;
build(v*2, tl, mid);
build(v*2+1, mid+1, tr);
d[v] = merge(d[v*2], d[v*2+1]);
}
}
asd query(int v, int tl, int tr, int l, int r){
if(tl > r || l > tr) return {-1, -1, -1, -1};
if(tl >= l && tr <= r) return d[v];
int mid = tl + tr >> 1;
return merge(query(v*2, tl, mid, l, r), query(v*2+1, mid+1, tr, l, r));
}
int get(int l, int r){
if(l > r) return 0;
int k = lg[r - l + 1];
return max(p[k][l], p[k][r - (1 << k) + 1]);
}
void init(int N, std::vector<int> H) {
n = N;
for(int i=1;i<=n;i++){
dp[i] = int(2e9) + 1;
a[i] = p[0][i] = H[i - 1];
position[a[i]] = i;
if(i > 1) lg[i] = lg[i / 2] + 1;
}
for(int k=1;k<20;k++){
for(int i=1;i + (1 << k) - 1 <= n;i++){
p[k][i] = max(p[k-1][i], p[k-1][i + (1 << (k - 1))]);
}
}
stack<int> s;
for(int i=1;i<=n;i++){
while(s.size() && a[s.top()] > a[i]){
s.pop();
}
if(s.size()){
dp[i] = get(s.top() + 1, i - 1);
}
s.push(i);
}
while(s.size()) s.pop();
for(int i=n;i;i--){
while(s.size() && a[s.top()] > a[i]){
s.pop();
}
if(s.size()){
dp[i] = min(dp[i], get(i + 1, s.top() - 1));
}
s.push(i);
ord[i] = {dp[i] - a[i], i};
}
sort(ord + 1, ord + n + 1, [](pair<int, int> x, pair<int, int> y){
return x > y;
});
root[0] = build(1, n);
build(1, 1, n);
for(int i=1;i<=n;i++){
root[i] = upd(root[i-1], 1, n, ord[i].s, 1);
}
}
int max_towers(int l, int r, int d) {
l++, r++;
int i = l, j = r, pos = 0;
for(int tl = 1, tr = n; tl <= tr;){
int mid = tl + tr >> 1;
if(ord[mid].f >= d){
pos = mid;
tl = mid + 1;
}
else tr = mid - 1;
}
int sx = get(root[pos], 1, n, 1, l - 1) + 1, sy = get(root[pos], 1, n, l, r), ans = sy;
if(sy == 0){
i = j = position[query(1, 1, n, l, r).mn];
ans = 1;
}
else{
i = get(root[pos], 1, n, sx), j = get(root[pos], 1, n, sx + sy - 1);
}
int L = 0, R = 0;
for(int tl = l + 1, tr = i - 1; tl <= tr;){
int mid = tl + tr >> 1;
if(query(1, 1, n, mid, i-1).mx >= a[i] + d){
L = mid;
tl = mid + 1;
}
else tr = mid - 1;
}
for(int tl = j + 1, tr = r - 1; tl <= tr;){
int mid = tl + tr >> 1;
if(query(1, 1, n, j + 1, mid).mx >= a[j] + d){
R = mid;
tr = mid - 1;
}
else tl = mid + 1;
}
if(L != 0 && query(1, 1, n, l, L).x >= d) ans++;
if(R != 0 && query(1, 1, n, R, r).y >= d) ans++;
return ans;
}
Compilation message
towers.cpp: In function 'int build(int, int)':
towers.cpp:22:17: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
22 | int mid = l + r >> 1;
| ~~^~~
towers.cpp: In function 'int upd(int, int, int, int, int)':
towers.cpp:35:18: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
35 | int mid = tl + tr >> 1;
| ~~~^~~~
towers.cpp: In function 'int get(int, int, int, int, int)':
towers.cpp:49:18: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
49 | int mid = tl + tr >> 1;
| ~~~^~~~
towers.cpp: In function 'int get(int, int, int, int)':
towers.cpp:55:18: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
55 | int mid = tl + tr >> 1;
| ~~~^~~~
towers.cpp: In function 'void build(int, int, int)':
towers.cpp:80:22: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
80 | int mid = tl + tr >> 1;
| ~~~^~~~
towers.cpp: In function 'asd query(int, int, int, int, int)':
towers.cpp:90:18: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
90 | int mid = tl + tr >> 1;
| ~~~^~~~
towers.cpp: In function 'int max_towers(int, int, int)':
towers.cpp:148:22: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
148 | int mid = tl + tr >> 1;
| ~~~^~~~
towers.cpp:166:22: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
166 | int mid = tl + tr >> 1;
| ~~~^~~~
towers.cpp:174:22: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
174 | int mid = tl + tr >> 1;
| ~~~^~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
582 ms |
29004 KB |
Output is correct |
2 |
Correct |
1279 ms |
43068 KB |
Output is correct |
3 |
Correct |
1255 ms |
43312 KB |
Output is correct |
4 |
Correct |
1286 ms |
43088 KB |
Output is correct |
5 |
Correct |
1255 ms |
43292 KB |
Output is correct |
6 |
Correct |
1240 ms |
43600 KB |
Output is correct |
7 |
Correct |
1239 ms |
43088 KB |
Output is correct |
8 |
Correct |
1 ms |
10584 KB |
Output is correct |
9 |
Correct |
2 ms |
9048 KB |
Output is correct |
10 |
Correct |
1 ms |
3160 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2648 KB |
Output is correct |
2 |
Correct |
2 ms |
4952 KB |
Output is correct |
3 |
Correct |
2 ms |
4952 KB |
Output is correct |
4 |
Correct |
2 ms |
3160 KB |
Output is correct |
5 |
Correct |
2 ms |
3160 KB |
Output is correct |
6 |
Correct |
1 ms |
3160 KB |
Output is correct |
7 |
Correct |
2 ms |
4952 KB |
Output is correct |
8 |
Correct |
1 ms |
3160 KB |
Output is correct |
9 |
Correct |
1 ms |
3160 KB |
Output is correct |
10 |
Correct |
2 ms |
9048 KB |
Output is correct |
11 |
Correct |
2 ms |
9048 KB |
Output is correct |
12 |
Correct |
1 ms |
4440 KB |
Output is correct |
13 |
Correct |
1 ms |
3160 KB |
Output is correct |
14 |
Correct |
1 ms |
3004 KB |
Output is correct |
15 |
Correct |
2 ms |
4952 KB |
Output is correct |
16 |
Correct |
1 ms |
3160 KB |
Output is correct |
17 |
Correct |
2 ms |
9048 KB |
Output is correct |
18 |
Correct |
1 ms |
3160 KB |
Output is correct |
19 |
Correct |
1 ms |
3160 KB |
Output is correct |
20 |
Correct |
2 ms |
4952 KB |
Output is correct |
21 |
Correct |
2 ms |
3160 KB |
Output is correct |
22 |
Correct |
2 ms |
5204 KB |
Output is correct |
23 |
Correct |
1 ms |
4952 KB |
Output is correct |
24 |
Correct |
2 ms |
3160 KB |
Output is correct |
25 |
Correct |
1 ms |
4696 KB |
Output is correct |
26 |
Correct |
2 ms |
9048 KB |
Output is correct |
27 |
Correct |
2 ms |
11096 KB |
Output is correct |
28 |
Correct |
2 ms |
3160 KB |
Output is correct |
29 |
Correct |
2 ms |
3160 KB |
Output is correct |
30 |
Correct |
1 ms |
3160 KB |
Output is correct |
31 |
Correct |
1 ms |
3160 KB |
Output is correct |
32 |
Correct |
1 ms |
3160 KB |
Output is correct |
33 |
Correct |
1 ms |
3160 KB |
Output is correct |
34 |
Correct |
1 ms |
3160 KB |
Output is correct |
35 |
Correct |
2 ms |
4952 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2648 KB |
Output is correct |
2 |
Correct |
2 ms |
4952 KB |
Output is correct |
3 |
Correct |
2 ms |
4952 KB |
Output is correct |
4 |
Correct |
2 ms |
3160 KB |
Output is correct |
5 |
Correct |
2 ms |
3160 KB |
Output is correct |
6 |
Correct |
1 ms |
3160 KB |
Output is correct |
7 |
Correct |
2 ms |
4952 KB |
Output is correct |
8 |
Correct |
1 ms |
3160 KB |
Output is correct |
9 |
Correct |
1 ms |
3160 KB |
Output is correct |
10 |
Correct |
2 ms |
9048 KB |
Output is correct |
11 |
Correct |
2 ms |
9048 KB |
Output is correct |
12 |
Correct |
1 ms |
4440 KB |
Output is correct |
13 |
Correct |
1 ms |
3160 KB |
Output is correct |
14 |
Correct |
1 ms |
3004 KB |
Output is correct |
15 |
Correct |
2 ms |
4952 KB |
Output is correct |
16 |
Correct |
1 ms |
3160 KB |
Output is correct |
17 |
Correct |
2 ms |
9048 KB |
Output is correct |
18 |
Correct |
1 ms |
3160 KB |
Output is correct |
19 |
Correct |
1 ms |
3160 KB |
Output is correct |
20 |
Correct |
2 ms |
4952 KB |
Output is correct |
21 |
Correct |
2 ms |
3160 KB |
Output is correct |
22 |
Correct |
2 ms |
5204 KB |
Output is correct |
23 |
Correct |
1 ms |
4952 KB |
Output is correct |
24 |
Correct |
2 ms |
3160 KB |
Output is correct |
25 |
Correct |
1 ms |
4696 KB |
Output is correct |
26 |
Correct |
2 ms |
9048 KB |
Output is correct |
27 |
Correct |
2 ms |
11096 KB |
Output is correct |
28 |
Correct |
2 ms |
3160 KB |
Output is correct |
29 |
Correct |
2 ms |
3160 KB |
Output is correct |
30 |
Correct |
1 ms |
3160 KB |
Output is correct |
31 |
Correct |
1 ms |
3160 KB |
Output is correct |
32 |
Correct |
1 ms |
3160 KB |
Output is correct |
33 |
Correct |
1 ms |
3160 KB |
Output is correct |
34 |
Correct |
1 ms |
3160 KB |
Output is correct |
35 |
Correct |
2 ms |
4952 KB |
Output is correct |
36 |
Correct |
51 ms |
27992 KB |
Output is correct |
37 |
Correct |
94 ms |
42648 KB |
Output is correct |
38 |
Correct |
92 ms |
42832 KB |
Output is correct |
39 |
Correct |
95 ms |
42648 KB |
Output is correct |
40 |
Correct |
80 ms |
42652 KB |
Output is correct |
41 |
Correct |
88 ms |
42816 KB |
Output is correct |
42 |
Correct |
85 ms |
42832 KB |
Output is correct |
43 |
Correct |
50 ms |
43092 KB |
Output is correct |
44 |
Correct |
47 ms |
43088 KB |
Output is correct |
45 |
Correct |
51 ms |
43124 KB |
Output is correct |
46 |
Correct |
49 ms |
43084 KB |
Output is correct |
47 |
Correct |
87 ms |
42832 KB |
Output is correct |
48 |
Correct |
85 ms |
42908 KB |
Output is correct |
49 |
Correct |
89 ms |
42832 KB |
Output is correct |
50 |
Correct |
49 ms |
43352 KB |
Output is correct |
51 |
Correct |
52 ms |
43340 KB |
Output is correct |
52 |
Correct |
88 ms |
42908 KB |
Output is correct |
53 |
Correct |
80 ms |
43088 KB |
Output is correct |
54 |
Correct |
112 ms |
42832 KB |
Output is correct |
55 |
Correct |
48 ms |
43088 KB |
Output is correct |
56 |
Correct |
53 ms |
43076 KB |
Output is correct |
57 |
Correct |
80 ms |
41552 KB |
Output is correct |
58 |
Correct |
79 ms |
43088 KB |
Output is correct |
59 |
Correct |
88 ms |
42832 KB |
Output is correct |
60 |
Correct |
91 ms |
43088 KB |
Output is correct |
61 |
Correct |
85 ms |
42744 KB |
Output is correct |
62 |
Correct |
87 ms |
43088 KB |
Output is correct |
63 |
Correct |
89 ms |
43084 KB |
Output is correct |
64 |
Correct |
55 ms |
43340 KB |
Output is correct |
65 |
Correct |
57 ms |
43172 KB |
Output is correct |
66 |
Correct |
51 ms |
43088 KB |
Output is correct |
67 |
Correct |
47 ms |
43088 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
693 ms |
42500 KB |
Output is correct |
2 |
Correct |
917 ms |
42832 KB |
Output is correct |
3 |
Correct |
979 ms |
40784 KB |
Output is correct |
4 |
Correct |
838 ms |
42832 KB |
Output is correct |
5 |
Correct |
796 ms |
42772 KB |
Output is correct |
6 |
Correct |
847 ms |
42832 KB |
Output is correct |
7 |
Correct |
859 ms |
43088 KB |
Output is correct |
8 |
Correct |
1262 ms |
43084 KB |
Output is correct |
9 |
Correct |
1208 ms |
43088 KB |
Output is correct |
10 |
Correct |
1377 ms |
43344 KB |
Output is correct |
11 |
Correct |
1346 ms |
43112 KB |
Output is correct |
12 |
Correct |
1238 ms |
43088 KB |
Output is correct |
13 |
Correct |
1205 ms |
43088 KB |
Output is correct |
14 |
Correct |
1 ms |
6488 KB |
Output is correct |
15 |
Correct |
2 ms |
9048 KB |
Output is correct |
16 |
Correct |
1 ms |
3160 KB |
Output is correct |
17 |
Correct |
88 ms |
42680 KB |
Output is correct |
18 |
Correct |
89 ms |
42832 KB |
Output is correct |
19 |
Correct |
88 ms |
42832 KB |
Output is correct |
20 |
Correct |
49 ms |
43088 KB |
Output is correct |
21 |
Correct |
47 ms |
43088 KB |
Output is correct |
22 |
Correct |
82 ms |
43088 KB |
Output is correct |
23 |
Correct |
91 ms |
42740 KB |
Output is correct |
24 |
Correct |
82 ms |
43088 KB |
Output is correct |
25 |
Correct |
49 ms |
43316 KB |
Output is correct |
26 |
Correct |
44 ms |
43096 KB |
Output is correct |
27 |
Correct |
2 ms |
11096 KB |
Output is correct |
28 |
Correct |
2 ms |
3160 KB |
Output is correct |
29 |
Correct |
1 ms |
3160 KB |
Output is correct |
30 |
Correct |
1 ms |
3160 KB |
Output is correct |
31 |
Correct |
1 ms |
3160 KB |
Output is correct |
32 |
Correct |
1 ms |
3160 KB |
Output is correct |
33 |
Correct |
1 ms |
4952 KB |
Output is correct |
34 |
Correct |
2 ms |
9048 KB |
Output is correct |
35 |
Correct |
2 ms |
9048 KB |
Output is correct |
36 |
Correct |
2 ms |
9048 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
207 ms |
11352 KB |
Output is correct |
2 |
Correct |
912 ms |
42828 KB |
Output is correct |
3 |
Correct |
837 ms |
42832 KB |
Output is correct |
4 |
Correct |
858 ms |
43032 KB |
Output is correct |
5 |
Correct |
856 ms |
42804 KB |
Output is correct |
6 |
Correct |
885 ms |
42832 KB |
Output is correct |
7 |
Correct |
832 ms |
43084 KB |
Output is correct |
8 |
Correct |
1126 ms |
43088 KB |
Output is correct |
9 |
Correct |
1146 ms |
43088 KB |
Output is correct |
10 |
Correct |
905 ms |
43344 KB |
Output is correct |
11 |
Correct |
1048 ms |
43088 KB |
Output is correct |
12 |
Correct |
89 ms |
43088 KB |
Output is correct |
13 |
Correct |
83 ms |
43088 KB |
Output is correct |
14 |
Correct |
81 ms |
43092 KB |
Output is correct |
15 |
Correct |
45 ms |
43096 KB |
Output is correct |
16 |
Correct |
49 ms |
43088 KB |
Output is correct |
17 |
Correct |
82 ms |
42064 KB |
Output is correct |
18 |
Correct |
89 ms |
42664 KB |
Output is correct |
19 |
Correct |
82 ms |
42752 KB |
Output is correct |
20 |
Correct |
82 ms |
42812 KB |
Output is correct |
21 |
Correct |
80 ms |
43088 KB |
Output is correct |
22 |
Correct |
83 ms |
42832 KB |
Output is correct |
23 |
Correct |
91 ms |
43088 KB |
Output is correct |
24 |
Correct |
49 ms |
43344 KB |
Output is correct |
25 |
Correct |
56 ms |
43088 KB |
Output is correct |
26 |
Correct |
47 ms |
43088 KB |
Output is correct |
27 |
Correct |
49 ms |
43040 KB |
Output is correct |
28 |
Correct |
2 ms |
9048 KB |
Output is correct |
29 |
Correct |
2 ms |
4952 KB |
Output is correct |
30 |
Correct |
2 ms |
9048 KB |
Output is correct |
31 |
Correct |
2 ms |
9048 KB |
Output is correct |
32 |
Correct |
2 ms |
10940 KB |
Output is correct |
33 |
Correct |
2 ms |
8792 KB |
Output is correct |
34 |
Correct |
2 ms |
4952 KB |
Output is correct |
35 |
Correct |
1 ms |
4952 KB |
Output is correct |
36 |
Correct |
2 ms |
4952 KB |
Output is correct |
37 |
Correct |
1 ms |
3160 KB |
Output is correct |
38 |
Correct |
2 ms |
9048 KB |
Output is correct |
39 |
Correct |
2 ms |
3160 KB |
Output is correct |
40 |
Correct |
1 ms |
3160 KB |
Output is correct |
41 |
Correct |
1 ms |
3160 KB |
Output is correct |
42 |
Correct |
2 ms |
9048 KB |
Output is correct |
43 |
Correct |
2 ms |
10928 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2648 KB |
Output is correct |
2 |
Correct |
2 ms |
4952 KB |
Output is correct |
3 |
Correct |
2 ms |
4952 KB |
Output is correct |
4 |
Correct |
2 ms |
3160 KB |
Output is correct |
5 |
Correct |
2 ms |
3160 KB |
Output is correct |
6 |
Correct |
1 ms |
3160 KB |
Output is correct |
7 |
Correct |
2 ms |
4952 KB |
Output is correct |
8 |
Correct |
1 ms |
3160 KB |
Output is correct |
9 |
Correct |
1 ms |
3160 KB |
Output is correct |
10 |
Correct |
2 ms |
9048 KB |
Output is correct |
11 |
Correct |
2 ms |
9048 KB |
Output is correct |
12 |
Correct |
1 ms |
4440 KB |
Output is correct |
13 |
Correct |
1 ms |
3160 KB |
Output is correct |
14 |
Correct |
1 ms |
3004 KB |
Output is correct |
15 |
Correct |
2 ms |
4952 KB |
Output is correct |
16 |
Correct |
1 ms |
3160 KB |
Output is correct |
17 |
Correct |
2 ms |
9048 KB |
Output is correct |
18 |
Correct |
1 ms |
3160 KB |
Output is correct |
19 |
Correct |
1 ms |
3160 KB |
Output is correct |
20 |
Correct |
2 ms |
4952 KB |
Output is correct |
21 |
Correct |
2 ms |
3160 KB |
Output is correct |
22 |
Correct |
2 ms |
5204 KB |
Output is correct |
23 |
Correct |
1 ms |
4952 KB |
Output is correct |
24 |
Correct |
2 ms |
3160 KB |
Output is correct |
25 |
Correct |
1 ms |
4696 KB |
Output is correct |
26 |
Correct |
2 ms |
9048 KB |
Output is correct |
27 |
Correct |
2 ms |
11096 KB |
Output is correct |
28 |
Correct |
2 ms |
3160 KB |
Output is correct |
29 |
Correct |
2 ms |
3160 KB |
Output is correct |
30 |
Correct |
1 ms |
3160 KB |
Output is correct |
31 |
Correct |
1 ms |
3160 KB |
Output is correct |
32 |
Correct |
1 ms |
3160 KB |
Output is correct |
33 |
Correct |
1 ms |
3160 KB |
Output is correct |
34 |
Correct |
1 ms |
3160 KB |
Output is correct |
35 |
Correct |
2 ms |
4952 KB |
Output is correct |
36 |
Correct |
51 ms |
27992 KB |
Output is correct |
37 |
Correct |
94 ms |
42648 KB |
Output is correct |
38 |
Correct |
92 ms |
42832 KB |
Output is correct |
39 |
Correct |
95 ms |
42648 KB |
Output is correct |
40 |
Correct |
80 ms |
42652 KB |
Output is correct |
41 |
Correct |
88 ms |
42816 KB |
Output is correct |
42 |
Correct |
85 ms |
42832 KB |
Output is correct |
43 |
Correct |
50 ms |
43092 KB |
Output is correct |
44 |
Correct |
47 ms |
43088 KB |
Output is correct |
45 |
Correct |
51 ms |
43124 KB |
Output is correct |
46 |
Correct |
49 ms |
43084 KB |
Output is correct |
47 |
Correct |
87 ms |
42832 KB |
Output is correct |
48 |
Correct |
85 ms |
42908 KB |
Output is correct |
49 |
Correct |
89 ms |
42832 KB |
Output is correct |
50 |
Correct |
49 ms |
43352 KB |
Output is correct |
51 |
Correct |
52 ms |
43340 KB |
Output is correct |
52 |
Correct |
88 ms |
42908 KB |
Output is correct |
53 |
Correct |
80 ms |
43088 KB |
Output is correct |
54 |
Correct |
112 ms |
42832 KB |
Output is correct |
55 |
Correct |
48 ms |
43088 KB |
Output is correct |
56 |
Correct |
53 ms |
43076 KB |
Output is correct |
57 |
Correct |
80 ms |
41552 KB |
Output is correct |
58 |
Correct |
79 ms |
43088 KB |
Output is correct |
59 |
Correct |
88 ms |
42832 KB |
Output is correct |
60 |
Correct |
91 ms |
43088 KB |
Output is correct |
61 |
Correct |
85 ms |
42744 KB |
Output is correct |
62 |
Correct |
87 ms |
43088 KB |
Output is correct |
63 |
Correct |
89 ms |
43084 KB |
Output is correct |
64 |
Correct |
55 ms |
43340 KB |
Output is correct |
65 |
Correct |
57 ms |
43172 KB |
Output is correct |
66 |
Correct |
51 ms |
43088 KB |
Output is correct |
67 |
Correct |
47 ms |
43088 KB |
Output is correct |
68 |
Correct |
693 ms |
42500 KB |
Output is correct |
69 |
Correct |
917 ms |
42832 KB |
Output is correct |
70 |
Correct |
979 ms |
40784 KB |
Output is correct |
71 |
Correct |
838 ms |
42832 KB |
Output is correct |
72 |
Correct |
796 ms |
42772 KB |
Output is correct |
73 |
Correct |
847 ms |
42832 KB |
Output is correct |
74 |
Correct |
859 ms |
43088 KB |
Output is correct |
75 |
Correct |
1262 ms |
43084 KB |
Output is correct |
76 |
Correct |
1208 ms |
43088 KB |
Output is correct |
77 |
Correct |
1377 ms |
43344 KB |
Output is correct |
78 |
Correct |
1346 ms |
43112 KB |
Output is correct |
79 |
Correct |
1238 ms |
43088 KB |
Output is correct |
80 |
Correct |
1205 ms |
43088 KB |
Output is correct |
81 |
Correct |
1 ms |
6488 KB |
Output is correct |
82 |
Correct |
2 ms |
9048 KB |
Output is correct |
83 |
Correct |
1 ms |
3160 KB |
Output is correct |
84 |
Correct |
88 ms |
42680 KB |
Output is correct |
85 |
Correct |
89 ms |
42832 KB |
Output is correct |
86 |
Correct |
88 ms |
42832 KB |
Output is correct |
87 |
Correct |
49 ms |
43088 KB |
Output is correct |
88 |
Correct |
47 ms |
43088 KB |
Output is correct |
89 |
Correct |
82 ms |
43088 KB |
Output is correct |
90 |
Correct |
91 ms |
42740 KB |
Output is correct |
91 |
Correct |
82 ms |
43088 KB |
Output is correct |
92 |
Correct |
49 ms |
43316 KB |
Output is correct |
93 |
Correct |
44 ms |
43096 KB |
Output is correct |
94 |
Correct |
2 ms |
11096 KB |
Output is correct |
95 |
Correct |
2 ms |
3160 KB |
Output is correct |
96 |
Correct |
1 ms |
3160 KB |
Output is correct |
97 |
Correct |
1 ms |
3160 KB |
Output is correct |
98 |
Correct |
1 ms |
3160 KB |
Output is correct |
99 |
Correct |
1 ms |
3160 KB |
Output is correct |
100 |
Correct |
1 ms |
4952 KB |
Output is correct |
101 |
Correct |
2 ms |
9048 KB |
Output is correct |
102 |
Correct |
2 ms |
9048 KB |
Output is correct |
103 |
Correct |
2 ms |
9048 KB |
Output is correct |
104 |
Correct |
788 ms |
39020 KB |
Output is correct |
105 |
Correct |
908 ms |
43088 KB |
Output is correct |
106 |
Correct |
928 ms |
42832 KB |
Output is correct |
107 |
Correct |
937 ms |
42832 KB |
Output is correct |
108 |
Correct |
1054 ms |
43088 KB |
Output is correct |
109 |
Correct |
909 ms |
42648 KB |
Output is correct |
110 |
Correct |
880 ms |
43088 KB |
Output is correct |
111 |
Correct |
1343 ms |
43088 KB |
Output is correct |
112 |
Correct |
1269 ms |
43344 KB |
Output is correct |
113 |
Correct |
1338 ms |
43112 KB |
Output is correct |
114 |
Correct |
1355 ms |
43024 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
582 ms |
29004 KB |
Output is correct |
2 |
Correct |
1279 ms |
43068 KB |
Output is correct |
3 |
Correct |
1255 ms |
43312 KB |
Output is correct |
4 |
Correct |
1286 ms |
43088 KB |
Output is correct |
5 |
Correct |
1255 ms |
43292 KB |
Output is correct |
6 |
Correct |
1240 ms |
43600 KB |
Output is correct |
7 |
Correct |
1239 ms |
43088 KB |
Output is correct |
8 |
Correct |
1 ms |
10584 KB |
Output is correct |
9 |
Correct |
2 ms |
9048 KB |
Output is correct |
10 |
Correct |
1 ms |
3160 KB |
Output is correct |
11 |
Correct |
1 ms |
2648 KB |
Output is correct |
12 |
Correct |
2 ms |
4952 KB |
Output is correct |
13 |
Correct |
2 ms |
4952 KB |
Output is correct |
14 |
Correct |
2 ms |
3160 KB |
Output is correct |
15 |
Correct |
2 ms |
3160 KB |
Output is correct |
16 |
Correct |
1 ms |
3160 KB |
Output is correct |
17 |
Correct |
2 ms |
4952 KB |
Output is correct |
18 |
Correct |
1 ms |
3160 KB |
Output is correct |
19 |
Correct |
1 ms |
3160 KB |
Output is correct |
20 |
Correct |
2 ms |
9048 KB |
Output is correct |
21 |
Correct |
2 ms |
9048 KB |
Output is correct |
22 |
Correct |
1 ms |
4440 KB |
Output is correct |
23 |
Correct |
1 ms |
3160 KB |
Output is correct |
24 |
Correct |
1 ms |
3004 KB |
Output is correct |
25 |
Correct |
2 ms |
4952 KB |
Output is correct |
26 |
Correct |
1 ms |
3160 KB |
Output is correct |
27 |
Correct |
2 ms |
9048 KB |
Output is correct |
28 |
Correct |
1 ms |
3160 KB |
Output is correct |
29 |
Correct |
1 ms |
3160 KB |
Output is correct |
30 |
Correct |
2 ms |
4952 KB |
Output is correct |
31 |
Correct |
2 ms |
3160 KB |
Output is correct |
32 |
Correct |
2 ms |
5204 KB |
Output is correct |
33 |
Correct |
1 ms |
4952 KB |
Output is correct |
34 |
Correct |
2 ms |
3160 KB |
Output is correct |
35 |
Correct |
1 ms |
4696 KB |
Output is correct |
36 |
Correct |
2 ms |
9048 KB |
Output is correct |
37 |
Correct |
2 ms |
11096 KB |
Output is correct |
38 |
Correct |
2 ms |
3160 KB |
Output is correct |
39 |
Correct |
2 ms |
3160 KB |
Output is correct |
40 |
Correct |
1 ms |
3160 KB |
Output is correct |
41 |
Correct |
1 ms |
3160 KB |
Output is correct |
42 |
Correct |
1 ms |
3160 KB |
Output is correct |
43 |
Correct |
1 ms |
3160 KB |
Output is correct |
44 |
Correct |
1 ms |
3160 KB |
Output is correct |
45 |
Correct |
2 ms |
4952 KB |
Output is correct |
46 |
Correct |
51 ms |
27992 KB |
Output is correct |
47 |
Correct |
94 ms |
42648 KB |
Output is correct |
48 |
Correct |
92 ms |
42832 KB |
Output is correct |
49 |
Correct |
95 ms |
42648 KB |
Output is correct |
50 |
Correct |
80 ms |
42652 KB |
Output is correct |
51 |
Correct |
88 ms |
42816 KB |
Output is correct |
52 |
Correct |
85 ms |
42832 KB |
Output is correct |
53 |
Correct |
50 ms |
43092 KB |
Output is correct |
54 |
Correct |
47 ms |
43088 KB |
Output is correct |
55 |
Correct |
51 ms |
43124 KB |
Output is correct |
56 |
Correct |
49 ms |
43084 KB |
Output is correct |
57 |
Correct |
87 ms |
42832 KB |
Output is correct |
58 |
Correct |
85 ms |
42908 KB |
Output is correct |
59 |
Correct |
89 ms |
42832 KB |
Output is correct |
60 |
Correct |
49 ms |
43352 KB |
Output is correct |
61 |
Correct |
52 ms |
43340 KB |
Output is correct |
62 |
Correct |
88 ms |
42908 KB |
Output is correct |
63 |
Correct |
80 ms |
43088 KB |
Output is correct |
64 |
Correct |
112 ms |
42832 KB |
Output is correct |
65 |
Correct |
48 ms |
43088 KB |
Output is correct |
66 |
Correct |
53 ms |
43076 KB |
Output is correct |
67 |
Correct |
80 ms |
41552 KB |
Output is correct |
68 |
Correct |
79 ms |
43088 KB |
Output is correct |
69 |
Correct |
88 ms |
42832 KB |
Output is correct |
70 |
Correct |
91 ms |
43088 KB |
Output is correct |
71 |
Correct |
85 ms |
42744 KB |
Output is correct |
72 |
Correct |
87 ms |
43088 KB |
Output is correct |
73 |
Correct |
89 ms |
43084 KB |
Output is correct |
74 |
Correct |
55 ms |
43340 KB |
Output is correct |
75 |
Correct |
57 ms |
43172 KB |
Output is correct |
76 |
Correct |
51 ms |
43088 KB |
Output is correct |
77 |
Correct |
47 ms |
43088 KB |
Output is correct |
78 |
Correct |
693 ms |
42500 KB |
Output is correct |
79 |
Correct |
917 ms |
42832 KB |
Output is correct |
80 |
Correct |
979 ms |
40784 KB |
Output is correct |
81 |
Correct |
838 ms |
42832 KB |
Output is correct |
82 |
Correct |
796 ms |
42772 KB |
Output is correct |
83 |
Correct |
847 ms |
42832 KB |
Output is correct |
84 |
Correct |
859 ms |
43088 KB |
Output is correct |
85 |
Correct |
1262 ms |
43084 KB |
Output is correct |
86 |
Correct |
1208 ms |
43088 KB |
Output is correct |
87 |
Correct |
1377 ms |
43344 KB |
Output is correct |
88 |
Correct |
1346 ms |
43112 KB |
Output is correct |
89 |
Correct |
1238 ms |
43088 KB |
Output is correct |
90 |
Correct |
1205 ms |
43088 KB |
Output is correct |
91 |
Correct |
1 ms |
6488 KB |
Output is correct |
92 |
Correct |
2 ms |
9048 KB |
Output is correct |
93 |
Correct |
1 ms |
3160 KB |
Output is correct |
94 |
Correct |
88 ms |
42680 KB |
Output is correct |
95 |
Correct |
89 ms |
42832 KB |
Output is correct |
96 |
Correct |
88 ms |
42832 KB |
Output is correct |
97 |
Correct |
49 ms |
43088 KB |
Output is correct |
98 |
Correct |
47 ms |
43088 KB |
Output is correct |
99 |
Correct |
82 ms |
43088 KB |
Output is correct |
100 |
Correct |
91 ms |
42740 KB |
Output is correct |
101 |
Correct |
82 ms |
43088 KB |
Output is correct |
102 |
Correct |
49 ms |
43316 KB |
Output is correct |
103 |
Correct |
44 ms |
43096 KB |
Output is correct |
104 |
Correct |
2 ms |
11096 KB |
Output is correct |
105 |
Correct |
2 ms |
3160 KB |
Output is correct |
106 |
Correct |
1 ms |
3160 KB |
Output is correct |
107 |
Correct |
1 ms |
3160 KB |
Output is correct |
108 |
Correct |
1 ms |
3160 KB |
Output is correct |
109 |
Correct |
1 ms |
3160 KB |
Output is correct |
110 |
Correct |
1 ms |
4952 KB |
Output is correct |
111 |
Correct |
2 ms |
9048 KB |
Output is correct |
112 |
Correct |
2 ms |
9048 KB |
Output is correct |
113 |
Correct |
2 ms |
9048 KB |
Output is correct |
114 |
Correct |
207 ms |
11352 KB |
Output is correct |
115 |
Correct |
912 ms |
42828 KB |
Output is correct |
116 |
Correct |
837 ms |
42832 KB |
Output is correct |
117 |
Correct |
858 ms |
43032 KB |
Output is correct |
118 |
Correct |
856 ms |
42804 KB |
Output is correct |
119 |
Correct |
885 ms |
42832 KB |
Output is correct |
120 |
Correct |
832 ms |
43084 KB |
Output is correct |
121 |
Correct |
1126 ms |
43088 KB |
Output is correct |
122 |
Correct |
1146 ms |
43088 KB |
Output is correct |
123 |
Correct |
905 ms |
43344 KB |
Output is correct |
124 |
Correct |
1048 ms |
43088 KB |
Output is correct |
125 |
Correct |
89 ms |
43088 KB |
Output is correct |
126 |
Correct |
83 ms |
43088 KB |
Output is correct |
127 |
Correct |
81 ms |
43092 KB |
Output is correct |
128 |
Correct |
45 ms |
43096 KB |
Output is correct |
129 |
Correct |
49 ms |
43088 KB |
Output is correct |
130 |
Correct |
82 ms |
42064 KB |
Output is correct |
131 |
Correct |
89 ms |
42664 KB |
Output is correct |
132 |
Correct |
82 ms |
42752 KB |
Output is correct |
133 |
Correct |
82 ms |
42812 KB |
Output is correct |
134 |
Correct |
80 ms |
43088 KB |
Output is correct |
135 |
Correct |
83 ms |
42832 KB |
Output is correct |
136 |
Correct |
91 ms |
43088 KB |
Output is correct |
137 |
Correct |
49 ms |
43344 KB |
Output is correct |
138 |
Correct |
56 ms |
43088 KB |
Output is correct |
139 |
Correct |
47 ms |
43088 KB |
Output is correct |
140 |
Correct |
49 ms |
43040 KB |
Output is correct |
141 |
Correct |
2 ms |
9048 KB |
Output is correct |
142 |
Correct |
2 ms |
4952 KB |
Output is correct |
143 |
Correct |
2 ms |
9048 KB |
Output is correct |
144 |
Correct |
2 ms |
9048 KB |
Output is correct |
145 |
Correct |
2 ms |
10940 KB |
Output is correct |
146 |
Correct |
2 ms |
8792 KB |
Output is correct |
147 |
Correct |
2 ms |
4952 KB |
Output is correct |
148 |
Correct |
1 ms |
4952 KB |
Output is correct |
149 |
Correct |
2 ms |
4952 KB |
Output is correct |
150 |
Correct |
1 ms |
3160 KB |
Output is correct |
151 |
Correct |
2 ms |
9048 KB |
Output is correct |
152 |
Correct |
2 ms |
3160 KB |
Output is correct |
153 |
Correct |
1 ms |
3160 KB |
Output is correct |
154 |
Correct |
1 ms |
3160 KB |
Output is correct |
155 |
Correct |
2 ms |
9048 KB |
Output is correct |
156 |
Correct |
2 ms |
10928 KB |
Output is correct |
157 |
Correct |
788 ms |
39020 KB |
Output is correct |
158 |
Correct |
908 ms |
43088 KB |
Output is correct |
159 |
Correct |
928 ms |
42832 KB |
Output is correct |
160 |
Correct |
937 ms |
42832 KB |
Output is correct |
161 |
Correct |
1054 ms |
43088 KB |
Output is correct |
162 |
Correct |
909 ms |
42648 KB |
Output is correct |
163 |
Correct |
880 ms |
43088 KB |
Output is correct |
164 |
Correct |
1343 ms |
43088 KB |
Output is correct |
165 |
Correct |
1269 ms |
43344 KB |
Output is correct |
166 |
Correct |
1338 ms |
43112 KB |
Output is correct |
167 |
Correct |
1355 ms |
43024 KB |
Output is correct |
168 |
Correct |
1 ms |
8536 KB |
Output is correct |
169 |
Correct |
634 ms |
21840 KB |
Output is correct |
170 |
Correct |
995 ms |
43088 KB |
Output is correct |
171 |
Correct |
1027 ms |
42832 KB |
Output is correct |
172 |
Correct |
1044 ms |
42880 KB |
Output is correct |
173 |
Correct |
1022 ms |
43092 KB |
Output is correct |
174 |
Correct |
1026 ms |
43088 KB |
Output is correct |
175 |
Correct |
1034 ms |
42644 KB |
Output is correct |
176 |
Correct |
1305 ms |
43344 KB |
Output is correct |
177 |
Correct |
1247 ms |
43344 KB |
Output is correct |
178 |
Correct |
1364 ms |
43344 KB |
Output is correct |
179 |
Correct |
1534 ms |
43088 KB |
Output is correct |