#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 |
618 ms |
31548 KB |
Output is correct |
2 |
Correct |
1470 ms |
41020 KB |
Output is correct |
3 |
Correct |
1355 ms |
44848 KB |
Output is correct |
4 |
Correct |
1421 ms |
43168 KB |
Output is correct |
5 |
Correct |
1321 ms |
43408 KB |
Output is correct |
6 |
Correct |
1296 ms |
43056 KB |
Output is correct |
7 |
Correct |
1291 ms |
43188 KB |
Output is correct |
8 |
Correct |
1 ms |
12632 KB |
Output is correct |
9 |
Correct |
2 ms |
4952 KB |
Output is correct |
10 |
Correct |
2 ms |
7000 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
600 KB |
Output is correct |
2 |
Correct |
2 ms |
7000 KB |
Output is correct |
3 |
Correct |
2 ms |
9048 KB |
Output is correct |
4 |
Correct |
2 ms |
3160 KB |
Output is correct |
5 |
Correct |
1 ms |
1112 KB |
Output is correct |
6 |
Correct |
2 ms |
1112 KB |
Output is correct |
7 |
Correct |
3 ms |
12888 KB |
Output is correct |
8 |
Correct |
1 ms |
1112 KB |
Output is correct |
9 |
Correct |
1 ms |
1112 KB |
Output is correct |
10 |
Correct |
1 ms |
1112 KB |
Output is correct |
11 |
Correct |
2 ms |
4952 KB |
Output is correct |
12 |
Correct |
0 ms |
344 KB |
Output is correct |
13 |
Correct |
1 ms |
1112 KB |
Output is correct |
14 |
Correct |
1 ms |
1112 KB |
Output is correct |
15 |
Correct |
1 ms |
4952 KB |
Output is correct |
16 |
Correct |
2 ms |
3160 KB |
Output is correct |
17 |
Correct |
2 ms |
4952 KB |
Output is correct |
18 |
Correct |
1 ms |
992 KB |
Output is correct |
19 |
Correct |
1 ms |
1112 KB |
Output is correct |
20 |
Correct |
3 ms |
7000 KB |
Output is correct |
21 |
Correct |
3 ms |
7000 KB |
Output is correct |
22 |
Correct |
2 ms |
3160 KB |
Output is correct |
23 |
Correct |
1 ms |
1112 KB |
Output is correct |
24 |
Correct |
1 ms |
1112 KB |
Output is correct |
25 |
Correct |
1 ms |
600 KB |
Output is correct |
26 |
Correct |
2 ms |
1112 KB |
Output is correct |
27 |
Correct |
1 ms |
1112 KB |
Output is correct |
28 |
Correct |
2 ms |
1112 KB |
Output is correct |
29 |
Correct |
2 ms |
9048 KB |
Output is correct |
30 |
Correct |
2 ms |
4952 KB |
Output is correct |
31 |
Correct |
1 ms |
1112 KB |
Output is correct |
32 |
Correct |
1 ms |
7000 KB |
Output is correct |
33 |
Correct |
2 ms |
7000 KB |
Output is correct |
34 |
Correct |
1 ms |
1112 KB |
Output is correct |
35 |
Correct |
1 ms |
1112 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
600 KB |
Output is correct |
2 |
Correct |
2 ms |
7000 KB |
Output is correct |
3 |
Correct |
2 ms |
9048 KB |
Output is correct |
4 |
Correct |
2 ms |
3160 KB |
Output is correct |
5 |
Correct |
1 ms |
1112 KB |
Output is correct |
6 |
Correct |
2 ms |
1112 KB |
Output is correct |
7 |
Correct |
3 ms |
12888 KB |
Output is correct |
8 |
Correct |
1 ms |
1112 KB |
Output is correct |
9 |
Correct |
1 ms |
1112 KB |
Output is correct |
10 |
Correct |
1 ms |
1112 KB |
Output is correct |
11 |
Correct |
2 ms |
4952 KB |
Output is correct |
12 |
Correct |
0 ms |
344 KB |
Output is correct |
13 |
Correct |
1 ms |
1112 KB |
Output is correct |
14 |
Correct |
1 ms |
1112 KB |
Output is correct |
15 |
Correct |
1 ms |
4952 KB |
Output is correct |
16 |
Correct |
2 ms |
3160 KB |
Output is correct |
17 |
Correct |
2 ms |
4952 KB |
Output is correct |
18 |
Correct |
1 ms |
992 KB |
Output is correct |
19 |
Correct |
1 ms |
1112 KB |
Output is correct |
20 |
Correct |
3 ms |
7000 KB |
Output is correct |
21 |
Correct |
3 ms |
7000 KB |
Output is correct |
22 |
Correct |
2 ms |
3160 KB |
Output is correct |
23 |
Correct |
1 ms |
1112 KB |
Output is correct |
24 |
Correct |
1 ms |
1112 KB |
Output is correct |
25 |
Correct |
1 ms |
600 KB |
Output is correct |
26 |
Correct |
2 ms |
1112 KB |
Output is correct |
27 |
Correct |
1 ms |
1112 KB |
Output is correct |
28 |
Correct |
2 ms |
1112 KB |
Output is correct |
29 |
Correct |
2 ms |
9048 KB |
Output is correct |
30 |
Correct |
2 ms |
4952 KB |
Output is correct |
31 |
Correct |
1 ms |
1112 KB |
Output is correct |
32 |
Correct |
1 ms |
7000 KB |
Output is correct |
33 |
Correct |
2 ms |
7000 KB |
Output is correct |
34 |
Correct |
1 ms |
1112 KB |
Output is correct |
35 |
Correct |
1 ms |
1112 KB |
Output is correct |
36 |
Correct |
60 ms |
25424 KB |
Output is correct |
37 |
Correct |
98 ms |
41808 KB |
Output is correct |
38 |
Correct |
91 ms |
42832 KB |
Output is correct |
39 |
Correct |
89 ms |
42828 KB |
Output is correct |
40 |
Correct |
84 ms |
42832 KB |
Output is correct |
41 |
Correct |
90 ms |
42752 KB |
Output is correct |
42 |
Correct |
85 ms |
43088 KB |
Output is correct |
43 |
Correct |
56 ms |
43088 KB |
Output is correct |
44 |
Correct |
46 ms |
43340 KB |
Output is correct |
45 |
Correct |
46 ms |
43328 KB |
Output is correct |
46 |
Correct |
74 ms |
43072 KB |
Output is correct |
47 |
Correct |
110 ms |
42832 KB |
Output is correct |
48 |
Correct |
81 ms |
42656 KB |
Output is correct |
49 |
Correct |
86 ms |
42828 KB |
Output is correct |
50 |
Correct |
48 ms |
43096 KB |
Output is correct |
51 |
Correct |
54 ms |
43088 KB |
Output is correct |
52 |
Correct |
88 ms |
43092 KB |
Output is correct |
53 |
Correct |
81 ms |
42832 KB |
Output is correct |
54 |
Correct |
83 ms |
42768 KB |
Output is correct |
55 |
Correct |
49 ms |
43088 KB |
Output is correct |
56 |
Correct |
48 ms |
43072 KB |
Output is correct |
57 |
Correct |
79 ms |
42064 KB |
Output is correct |
58 |
Correct |
85 ms |
42832 KB |
Output is correct |
59 |
Correct |
87 ms |
42816 KB |
Output is correct |
60 |
Correct |
87 ms |
42972 KB |
Output is correct |
61 |
Correct |
85 ms |
43088 KB |
Output is correct |
62 |
Correct |
85 ms |
43088 KB |
Output is correct |
63 |
Correct |
84 ms |
42832 KB |
Output is correct |
64 |
Correct |
53 ms |
43088 KB |
Output is correct |
65 |
Correct |
48 ms |
43408 KB |
Output is correct |
66 |
Correct |
46 ms |
42912 KB |
Output is correct |
67 |
Correct |
54 ms |
43088 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
669 ms |
42844 KB |
Output is correct |
2 |
Correct |
902 ms |
43096 KB |
Output is correct |
3 |
Correct |
840 ms |
43076 KB |
Output is correct |
4 |
Correct |
833 ms |
42828 KB |
Output is correct |
5 |
Correct |
850 ms |
42832 KB |
Output is correct |
6 |
Correct |
814 ms |
42836 KB |
Output is correct |
7 |
Correct |
813 ms |
43088 KB |
Output is correct |
8 |
Correct |
1164 ms |
43068 KB |
Output is correct |
9 |
Correct |
1202 ms |
43344 KB |
Output is correct |
10 |
Correct |
1270 ms |
43088 KB |
Output is correct |
11 |
Correct |
1297 ms |
43088 KB |
Output is correct |
12 |
Correct |
1169 ms |
43344 KB |
Output is correct |
13 |
Correct |
1231 ms |
43348 KB |
Output is correct |
14 |
Correct |
1 ms |
10584 KB |
Output is correct |
15 |
Correct |
2 ms |
3160 KB |
Output is correct |
16 |
Correct |
1 ms |
3160 KB |
Output is correct |
17 |
Correct |
91 ms |
42744 KB |
Output is correct |
18 |
Correct |
87 ms |
43092 KB |
Output is correct |
19 |
Correct |
85 ms |
42736 KB |
Output is correct |
20 |
Correct |
49 ms |
43332 KB |
Output is correct |
21 |
Correct |
47 ms |
43352 KB |
Output is correct |
22 |
Correct |
93 ms |
42832 KB |
Output is correct |
23 |
Correct |
96 ms |
43088 KB |
Output is correct |
24 |
Correct |
88 ms |
42828 KB |
Output is correct |
25 |
Correct |
55 ms |
43284 KB |
Output is correct |
26 |
Correct |
48 ms |
43088 KB |
Output is correct |
27 |
Correct |
2 ms |
9048 KB |
Output is correct |
28 |
Correct |
2 ms |
9048 KB |
Output is correct |
29 |
Correct |
2 ms |
11096 KB |
Output is correct |
30 |
Correct |
1 ms |
3160 KB |
Output is correct |
31 |
Correct |
1 ms |
3160 KB |
Output is correct |
32 |
Correct |
2 ms |
4952 KB |
Output is correct |
33 |
Correct |
2 ms |
4952 KB |
Output is correct |
34 |
Correct |
2 ms |
4952 KB |
Output is correct |
35 |
Correct |
1 ms |
8960 KB |
Output is correct |
36 |
Correct |
2 ms |
11096 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
254 ms |
15960 KB |
Output is correct |
2 |
Correct |
856 ms |
42832 KB |
Output is correct |
3 |
Correct |
819 ms |
42832 KB |
Output is correct |
4 |
Correct |
803 ms |
43088 KB |
Output is correct |
5 |
Correct |
853 ms |
43088 KB |
Output is correct |
6 |
Correct |
835 ms |
42668 KB |
Output is correct |
7 |
Correct |
871 ms |
42932 KB |
Output is correct |
8 |
Correct |
1138 ms |
43128 KB |
Output is correct |
9 |
Correct |
1227 ms |
43332 KB |
Output is correct |
10 |
Correct |
913 ms |
42944 KB |
Output is correct |
11 |
Correct |
1071 ms |
43356 KB |
Output is correct |
12 |
Correct |
86 ms |
42832 KB |
Output is correct |
13 |
Correct |
86 ms |
42832 KB |
Output is correct |
14 |
Correct |
82 ms |
42836 KB |
Output is correct |
15 |
Correct |
51 ms |
43096 KB |
Output is correct |
16 |
Correct |
45 ms |
43088 KB |
Output is correct |
17 |
Correct |
88 ms |
41948 KB |
Output is correct |
18 |
Correct |
84 ms |
43088 KB |
Output is correct |
19 |
Correct |
84 ms |
42832 KB |
Output is correct |
20 |
Correct |
82 ms |
42832 KB |
Output is correct |
21 |
Correct |
86 ms |
42836 KB |
Output is correct |
22 |
Correct |
83 ms |
43576 KB |
Output is correct |
23 |
Correct |
79 ms |
42652 KB |
Output is correct |
24 |
Correct |
45 ms |
43088 KB |
Output is correct |
25 |
Correct |
46 ms |
43328 KB |
Output is correct |
26 |
Correct |
46 ms |
43088 KB |
Output is correct |
27 |
Correct |
57 ms |
43584 KB |
Output is correct |
28 |
Correct |
2 ms |
9048 KB |
Output is correct |
29 |
Correct |
1 ms |
4952 KB |
Output is correct |
30 |
Correct |
1 ms |
3160 KB |
Output is correct |
31 |
Correct |
1 ms |
4952 KB |
Output is correct |
32 |
Correct |
2 ms |
9048 KB |
Output is correct |
33 |
Correct |
1 ms |
8792 KB |
Output is correct |
34 |
Correct |
2 ms |
9300 KB |
Output is correct |
35 |
Correct |
2 ms |
4952 KB |
Output is correct |
36 |
Correct |
1 ms |
3020 KB |
Output is correct |
37 |
Correct |
2 ms |
4952 KB |
Output is correct |
38 |
Correct |
2 ms |
3160 KB |
Output is correct |
39 |
Correct |
1 ms |
4952 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 |
5008 KB |
Output is correct |
43 |
Correct |
2 ms |
4952 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
600 KB |
Output is correct |
2 |
Correct |
2 ms |
7000 KB |
Output is correct |
3 |
Correct |
2 ms |
9048 KB |
Output is correct |
4 |
Correct |
2 ms |
3160 KB |
Output is correct |
5 |
Correct |
1 ms |
1112 KB |
Output is correct |
6 |
Correct |
2 ms |
1112 KB |
Output is correct |
7 |
Correct |
3 ms |
12888 KB |
Output is correct |
8 |
Correct |
1 ms |
1112 KB |
Output is correct |
9 |
Correct |
1 ms |
1112 KB |
Output is correct |
10 |
Correct |
1 ms |
1112 KB |
Output is correct |
11 |
Correct |
2 ms |
4952 KB |
Output is correct |
12 |
Correct |
0 ms |
344 KB |
Output is correct |
13 |
Correct |
1 ms |
1112 KB |
Output is correct |
14 |
Correct |
1 ms |
1112 KB |
Output is correct |
15 |
Correct |
1 ms |
4952 KB |
Output is correct |
16 |
Correct |
2 ms |
3160 KB |
Output is correct |
17 |
Correct |
2 ms |
4952 KB |
Output is correct |
18 |
Correct |
1 ms |
992 KB |
Output is correct |
19 |
Correct |
1 ms |
1112 KB |
Output is correct |
20 |
Correct |
3 ms |
7000 KB |
Output is correct |
21 |
Correct |
3 ms |
7000 KB |
Output is correct |
22 |
Correct |
2 ms |
3160 KB |
Output is correct |
23 |
Correct |
1 ms |
1112 KB |
Output is correct |
24 |
Correct |
1 ms |
1112 KB |
Output is correct |
25 |
Correct |
1 ms |
600 KB |
Output is correct |
26 |
Correct |
2 ms |
1112 KB |
Output is correct |
27 |
Correct |
1 ms |
1112 KB |
Output is correct |
28 |
Correct |
2 ms |
1112 KB |
Output is correct |
29 |
Correct |
2 ms |
9048 KB |
Output is correct |
30 |
Correct |
2 ms |
4952 KB |
Output is correct |
31 |
Correct |
1 ms |
1112 KB |
Output is correct |
32 |
Correct |
1 ms |
7000 KB |
Output is correct |
33 |
Correct |
2 ms |
7000 KB |
Output is correct |
34 |
Correct |
1 ms |
1112 KB |
Output is correct |
35 |
Correct |
1 ms |
1112 KB |
Output is correct |
36 |
Correct |
60 ms |
25424 KB |
Output is correct |
37 |
Correct |
98 ms |
41808 KB |
Output is correct |
38 |
Correct |
91 ms |
42832 KB |
Output is correct |
39 |
Correct |
89 ms |
42828 KB |
Output is correct |
40 |
Correct |
84 ms |
42832 KB |
Output is correct |
41 |
Correct |
90 ms |
42752 KB |
Output is correct |
42 |
Correct |
85 ms |
43088 KB |
Output is correct |
43 |
Correct |
56 ms |
43088 KB |
Output is correct |
44 |
Correct |
46 ms |
43340 KB |
Output is correct |
45 |
Correct |
46 ms |
43328 KB |
Output is correct |
46 |
Correct |
74 ms |
43072 KB |
Output is correct |
47 |
Correct |
110 ms |
42832 KB |
Output is correct |
48 |
Correct |
81 ms |
42656 KB |
Output is correct |
49 |
Correct |
86 ms |
42828 KB |
Output is correct |
50 |
Correct |
48 ms |
43096 KB |
Output is correct |
51 |
Correct |
54 ms |
43088 KB |
Output is correct |
52 |
Correct |
88 ms |
43092 KB |
Output is correct |
53 |
Correct |
81 ms |
42832 KB |
Output is correct |
54 |
Correct |
83 ms |
42768 KB |
Output is correct |
55 |
Correct |
49 ms |
43088 KB |
Output is correct |
56 |
Correct |
48 ms |
43072 KB |
Output is correct |
57 |
Correct |
79 ms |
42064 KB |
Output is correct |
58 |
Correct |
85 ms |
42832 KB |
Output is correct |
59 |
Correct |
87 ms |
42816 KB |
Output is correct |
60 |
Correct |
87 ms |
42972 KB |
Output is correct |
61 |
Correct |
85 ms |
43088 KB |
Output is correct |
62 |
Correct |
85 ms |
43088 KB |
Output is correct |
63 |
Correct |
84 ms |
42832 KB |
Output is correct |
64 |
Correct |
53 ms |
43088 KB |
Output is correct |
65 |
Correct |
48 ms |
43408 KB |
Output is correct |
66 |
Correct |
46 ms |
42912 KB |
Output is correct |
67 |
Correct |
54 ms |
43088 KB |
Output is correct |
68 |
Correct |
669 ms |
42844 KB |
Output is correct |
69 |
Correct |
902 ms |
43096 KB |
Output is correct |
70 |
Correct |
840 ms |
43076 KB |
Output is correct |
71 |
Correct |
833 ms |
42828 KB |
Output is correct |
72 |
Correct |
850 ms |
42832 KB |
Output is correct |
73 |
Correct |
814 ms |
42836 KB |
Output is correct |
74 |
Correct |
813 ms |
43088 KB |
Output is correct |
75 |
Correct |
1164 ms |
43068 KB |
Output is correct |
76 |
Correct |
1202 ms |
43344 KB |
Output is correct |
77 |
Correct |
1270 ms |
43088 KB |
Output is correct |
78 |
Correct |
1297 ms |
43088 KB |
Output is correct |
79 |
Correct |
1169 ms |
43344 KB |
Output is correct |
80 |
Correct |
1231 ms |
43348 KB |
Output is correct |
81 |
Correct |
1 ms |
10584 KB |
Output is correct |
82 |
Correct |
2 ms |
3160 KB |
Output is correct |
83 |
Correct |
1 ms |
3160 KB |
Output is correct |
84 |
Correct |
91 ms |
42744 KB |
Output is correct |
85 |
Correct |
87 ms |
43092 KB |
Output is correct |
86 |
Correct |
85 ms |
42736 KB |
Output is correct |
87 |
Correct |
49 ms |
43332 KB |
Output is correct |
88 |
Correct |
47 ms |
43352 KB |
Output is correct |
89 |
Correct |
93 ms |
42832 KB |
Output is correct |
90 |
Correct |
96 ms |
43088 KB |
Output is correct |
91 |
Correct |
88 ms |
42828 KB |
Output is correct |
92 |
Correct |
55 ms |
43284 KB |
Output is correct |
93 |
Correct |
48 ms |
43088 KB |
Output is correct |
94 |
Correct |
2 ms |
9048 KB |
Output is correct |
95 |
Correct |
2 ms |
9048 KB |
Output is correct |
96 |
Correct |
2 ms |
11096 KB |
Output is correct |
97 |
Correct |
1 ms |
3160 KB |
Output is correct |
98 |
Correct |
1 ms |
3160 KB |
Output is correct |
99 |
Correct |
2 ms |
4952 KB |
Output is correct |
100 |
Correct |
2 ms |
4952 KB |
Output is correct |
101 |
Correct |
2 ms |
4952 KB |
Output is correct |
102 |
Correct |
1 ms |
8960 KB |
Output is correct |
103 |
Correct |
2 ms |
11096 KB |
Output is correct |
104 |
Correct |
796 ms |
38480 KB |
Output is correct |
105 |
Correct |
928 ms |
43092 KB |
Output is correct |
106 |
Correct |
978 ms |
42864 KB |
Output is correct |
107 |
Correct |
860 ms |
42832 KB |
Output is correct |
108 |
Correct |
964 ms |
42648 KB |
Output is correct |
109 |
Correct |
869 ms |
42836 KB |
Output is correct |
110 |
Correct |
850 ms |
43088 KB |
Output is correct |
111 |
Correct |
1238 ms |
43344 KB |
Output is correct |
112 |
Correct |
1181 ms |
43340 KB |
Output is correct |
113 |
Correct |
1415 ms |
43088 KB |
Output is correct |
114 |
Correct |
1301 ms |
43088 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
618 ms |
31548 KB |
Output is correct |
2 |
Correct |
1470 ms |
41020 KB |
Output is correct |
3 |
Correct |
1355 ms |
44848 KB |
Output is correct |
4 |
Correct |
1421 ms |
43168 KB |
Output is correct |
5 |
Correct |
1321 ms |
43408 KB |
Output is correct |
6 |
Correct |
1296 ms |
43056 KB |
Output is correct |
7 |
Correct |
1291 ms |
43188 KB |
Output is correct |
8 |
Correct |
1 ms |
12632 KB |
Output is correct |
9 |
Correct |
2 ms |
4952 KB |
Output is correct |
10 |
Correct |
2 ms |
7000 KB |
Output is correct |
11 |
Correct |
1 ms |
600 KB |
Output is correct |
12 |
Correct |
2 ms |
7000 KB |
Output is correct |
13 |
Correct |
2 ms |
9048 KB |
Output is correct |
14 |
Correct |
2 ms |
3160 KB |
Output is correct |
15 |
Correct |
1 ms |
1112 KB |
Output is correct |
16 |
Correct |
2 ms |
1112 KB |
Output is correct |
17 |
Correct |
3 ms |
12888 KB |
Output is correct |
18 |
Correct |
1 ms |
1112 KB |
Output is correct |
19 |
Correct |
1 ms |
1112 KB |
Output is correct |
20 |
Correct |
1 ms |
1112 KB |
Output is correct |
21 |
Correct |
2 ms |
4952 KB |
Output is correct |
22 |
Correct |
0 ms |
344 KB |
Output is correct |
23 |
Correct |
1 ms |
1112 KB |
Output is correct |
24 |
Correct |
1 ms |
1112 KB |
Output is correct |
25 |
Correct |
1 ms |
4952 KB |
Output is correct |
26 |
Correct |
2 ms |
3160 KB |
Output is correct |
27 |
Correct |
2 ms |
4952 KB |
Output is correct |
28 |
Correct |
1 ms |
992 KB |
Output is correct |
29 |
Correct |
1 ms |
1112 KB |
Output is correct |
30 |
Correct |
3 ms |
7000 KB |
Output is correct |
31 |
Correct |
3 ms |
7000 KB |
Output is correct |
32 |
Correct |
2 ms |
3160 KB |
Output is correct |
33 |
Correct |
1 ms |
1112 KB |
Output is correct |
34 |
Correct |
1 ms |
1112 KB |
Output is correct |
35 |
Correct |
1 ms |
600 KB |
Output is correct |
36 |
Correct |
2 ms |
1112 KB |
Output is correct |
37 |
Correct |
1 ms |
1112 KB |
Output is correct |
38 |
Correct |
2 ms |
1112 KB |
Output is correct |
39 |
Correct |
2 ms |
9048 KB |
Output is correct |
40 |
Correct |
2 ms |
4952 KB |
Output is correct |
41 |
Correct |
1 ms |
1112 KB |
Output is correct |
42 |
Correct |
1 ms |
7000 KB |
Output is correct |
43 |
Correct |
2 ms |
7000 KB |
Output is correct |
44 |
Correct |
1 ms |
1112 KB |
Output is correct |
45 |
Correct |
1 ms |
1112 KB |
Output is correct |
46 |
Correct |
60 ms |
25424 KB |
Output is correct |
47 |
Correct |
98 ms |
41808 KB |
Output is correct |
48 |
Correct |
91 ms |
42832 KB |
Output is correct |
49 |
Correct |
89 ms |
42828 KB |
Output is correct |
50 |
Correct |
84 ms |
42832 KB |
Output is correct |
51 |
Correct |
90 ms |
42752 KB |
Output is correct |
52 |
Correct |
85 ms |
43088 KB |
Output is correct |
53 |
Correct |
56 ms |
43088 KB |
Output is correct |
54 |
Correct |
46 ms |
43340 KB |
Output is correct |
55 |
Correct |
46 ms |
43328 KB |
Output is correct |
56 |
Correct |
74 ms |
43072 KB |
Output is correct |
57 |
Correct |
110 ms |
42832 KB |
Output is correct |
58 |
Correct |
81 ms |
42656 KB |
Output is correct |
59 |
Correct |
86 ms |
42828 KB |
Output is correct |
60 |
Correct |
48 ms |
43096 KB |
Output is correct |
61 |
Correct |
54 ms |
43088 KB |
Output is correct |
62 |
Correct |
88 ms |
43092 KB |
Output is correct |
63 |
Correct |
81 ms |
42832 KB |
Output is correct |
64 |
Correct |
83 ms |
42768 KB |
Output is correct |
65 |
Correct |
49 ms |
43088 KB |
Output is correct |
66 |
Correct |
48 ms |
43072 KB |
Output is correct |
67 |
Correct |
79 ms |
42064 KB |
Output is correct |
68 |
Correct |
85 ms |
42832 KB |
Output is correct |
69 |
Correct |
87 ms |
42816 KB |
Output is correct |
70 |
Correct |
87 ms |
42972 KB |
Output is correct |
71 |
Correct |
85 ms |
43088 KB |
Output is correct |
72 |
Correct |
85 ms |
43088 KB |
Output is correct |
73 |
Correct |
84 ms |
42832 KB |
Output is correct |
74 |
Correct |
53 ms |
43088 KB |
Output is correct |
75 |
Correct |
48 ms |
43408 KB |
Output is correct |
76 |
Correct |
46 ms |
42912 KB |
Output is correct |
77 |
Correct |
54 ms |
43088 KB |
Output is correct |
78 |
Correct |
669 ms |
42844 KB |
Output is correct |
79 |
Correct |
902 ms |
43096 KB |
Output is correct |
80 |
Correct |
840 ms |
43076 KB |
Output is correct |
81 |
Correct |
833 ms |
42828 KB |
Output is correct |
82 |
Correct |
850 ms |
42832 KB |
Output is correct |
83 |
Correct |
814 ms |
42836 KB |
Output is correct |
84 |
Correct |
813 ms |
43088 KB |
Output is correct |
85 |
Correct |
1164 ms |
43068 KB |
Output is correct |
86 |
Correct |
1202 ms |
43344 KB |
Output is correct |
87 |
Correct |
1270 ms |
43088 KB |
Output is correct |
88 |
Correct |
1297 ms |
43088 KB |
Output is correct |
89 |
Correct |
1169 ms |
43344 KB |
Output is correct |
90 |
Correct |
1231 ms |
43348 KB |
Output is correct |
91 |
Correct |
1 ms |
10584 KB |
Output is correct |
92 |
Correct |
2 ms |
3160 KB |
Output is correct |
93 |
Correct |
1 ms |
3160 KB |
Output is correct |
94 |
Correct |
91 ms |
42744 KB |
Output is correct |
95 |
Correct |
87 ms |
43092 KB |
Output is correct |
96 |
Correct |
85 ms |
42736 KB |
Output is correct |
97 |
Correct |
49 ms |
43332 KB |
Output is correct |
98 |
Correct |
47 ms |
43352 KB |
Output is correct |
99 |
Correct |
93 ms |
42832 KB |
Output is correct |
100 |
Correct |
96 ms |
43088 KB |
Output is correct |
101 |
Correct |
88 ms |
42828 KB |
Output is correct |
102 |
Correct |
55 ms |
43284 KB |
Output is correct |
103 |
Correct |
48 ms |
43088 KB |
Output is correct |
104 |
Correct |
2 ms |
9048 KB |
Output is correct |
105 |
Correct |
2 ms |
9048 KB |
Output is correct |
106 |
Correct |
2 ms |
11096 KB |
Output is correct |
107 |
Correct |
1 ms |
3160 KB |
Output is correct |
108 |
Correct |
1 ms |
3160 KB |
Output is correct |
109 |
Correct |
2 ms |
4952 KB |
Output is correct |
110 |
Correct |
2 ms |
4952 KB |
Output is correct |
111 |
Correct |
2 ms |
4952 KB |
Output is correct |
112 |
Correct |
1 ms |
8960 KB |
Output is correct |
113 |
Correct |
2 ms |
11096 KB |
Output is correct |
114 |
Correct |
254 ms |
15960 KB |
Output is correct |
115 |
Correct |
856 ms |
42832 KB |
Output is correct |
116 |
Correct |
819 ms |
42832 KB |
Output is correct |
117 |
Correct |
803 ms |
43088 KB |
Output is correct |
118 |
Correct |
853 ms |
43088 KB |
Output is correct |
119 |
Correct |
835 ms |
42668 KB |
Output is correct |
120 |
Correct |
871 ms |
42932 KB |
Output is correct |
121 |
Correct |
1138 ms |
43128 KB |
Output is correct |
122 |
Correct |
1227 ms |
43332 KB |
Output is correct |
123 |
Correct |
913 ms |
42944 KB |
Output is correct |
124 |
Correct |
1071 ms |
43356 KB |
Output is correct |
125 |
Correct |
86 ms |
42832 KB |
Output is correct |
126 |
Correct |
86 ms |
42832 KB |
Output is correct |
127 |
Correct |
82 ms |
42836 KB |
Output is correct |
128 |
Correct |
51 ms |
43096 KB |
Output is correct |
129 |
Correct |
45 ms |
43088 KB |
Output is correct |
130 |
Correct |
88 ms |
41948 KB |
Output is correct |
131 |
Correct |
84 ms |
43088 KB |
Output is correct |
132 |
Correct |
84 ms |
42832 KB |
Output is correct |
133 |
Correct |
82 ms |
42832 KB |
Output is correct |
134 |
Correct |
86 ms |
42836 KB |
Output is correct |
135 |
Correct |
83 ms |
43576 KB |
Output is correct |
136 |
Correct |
79 ms |
42652 KB |
Output is correct |
137 |
Correct |
45 ms |
43088 KB |
Output is correct |
138 |
Correct |
46 ms |
43328 KB |
Output is correct |
139 |
Correct |
46 ms |
43088 KB |
Output is correct |
140 |
Correct |
57 ms |
43584 KB |
Output is correct |
141 |
Correct |
2 ms |
9048 KB |
Output is correct |
142 |
Correct |
1 ms |
4952 KB |
Output is correct |
143 |
Correct |
1 ms |
3160 KB |
Output is correct |
144 |
Correct |
1 ms |
4952 KB |
Output is correct |
145 |
Correct |
2 ms |
9048 KB |
Output is correct |
146 |
Correct |
1 ms |
8792 KB |
Output is correct |
147 |
Correct |
2 ms |
9300 KB |
Output is correct |
148 |
Correct |
2 ms |
4952 KB |
Output is correct |
149 |
Correct |
1 ms |
3020 KB |
Output is correct |
150 |
Correct |
2 ms |
4952 KB |
Output is correct |
151 |
Correct |
2 ms |
3160 KB |
Output is correct |
152 |
Correct |
1 ms |
4952 KB |
Output is correct |
153 |
Correct |
1 ms |
3160 KB |
Output is correct |
154 |
Correct |
1 ms |
3160 KB |
Output is correct |
155 |
Correct |
1 ms |
5008 KB |
Output is correct |
156 |
Correct |
2 ms |
4952 KB |
Output is correct |
157 |
Correct |
796 ms |
38480 KB |
Output is correct |
158 |
Correct |
928 ms |
43092 KB |
Output is correct |
159 |
Correct |
978 ms |
42864 KB |
Output is correct |
160 |
Correct |
860 ms |
42832 KB |
Output is correct |
161 |
Correct |
964 ms |
42648 KB |
Output is correct |
162 |
Correct |
869 ms |
42836 KB |
Output is correct |
163 |
Correct |
850 ms |
43088 KB |
Output is correct |
164 |
Correct |
1238 ms |
43344 KB |
Output is correct |
165 |
Correct |
1181 ms |
43340 KB |
Output is correct |
166 |
Correct |
1415 ms |
43088 KB |
Output is correct |
167 |
Correct |
1301 ms |
43088 KB |
Output is correct |
168 |
Correct |
1 ms |
10584 KB |
Output is correct |
169 |
Correct |
576 ms |
20108 KB |
Output is correct |
170 |
Correct |
994 ms |
43060 KB |
Output is correct |
171 |
Correct |
1002 ms |
42832 KB |
Output is correct |
172 |
Correct |
1020 ms |
43084 KB |
Output is correct |
173 |
Correct |
1016 ms |
42832 KB |
Output is correct |
174 |
Correct |
1008 ms |
43060 KB |
Output is correct |
175 |
Correct |
1008 ms |
42832 KB |
Output is correct |
176 |
Correct |
1260 ms |
43232 KB |
Output is correct |
177 |
Correct |
1223 ms |
43096 KB |
Output is correct |
178 |
Correct |
1326 ms |
43344 KB |
Output is correct |
179 |
Correct |
1350 ms |
43088 KB |
Output is correct |