#include <bits/stdc++.h>
#include "towers.h"
using namespace std;
const int B = 200;
int N, spec, first;
vector<int> H, lw;
vector<pair<int, int>> candidates;
vector<vector<pair<int, int>>> mn, mx;
vector<vector<int>> prefix;
void precalcmx(){
mx.assign(20, vector<pair<int, int>>(N));
for(int k = 0; k < 20; k++){
for(int i = 0; i < N; i++){
if(k == 0) mx[k][i] = {H[i], i};
else{
if(i - (1 << (k-1)) < 0) mx[k][i] = mx[k-1][i];
else{
mx[k][i] = max(mx[k-1][i], mx[k-1][i - (1 << (k-1))]);
}
}
}
}
}
void precalcmn(){
mn.assign(20, vector<pair<int, int>>(N));
for(int k = 0; k < 20; k++){
for(int i = 0; i < N; i++){
if(k == 0) mn[k][i] = {H[i], i};
else{
if(i - (1 << (k-1)) < 0) mn[k][i] = mn[k-1][i];
else{
mn[k][i] = min(mn[k-1][i], mn[k-1][i - (1 << (k-1))]);
}
}
}
}
}
void precalclw(){
lw.resize(N+1);
int pw = 0;
int curr = 2;
for(int i = 1; i <= N; i++){
if(i == curr){
pw++; curr *= 2;
}
lw[i] = pw;
}
}
pair<int, int> get_mx(int l, int r){
if(r < l) return {-2e9, 0};
int k = lw[r - l + 1];
return max(mx[k][r], mx[k][l + (1 << k) - 1]);
}
pair<int, int> get_mn(int l, int r){
if(r < l) return {2e9, 0};
int k = lw[r - l + 1];
return min(mn[k][r], mn[k][l + (1 << k) - 1]);
}
int get_first(int L, vector<int>& pre){
int lo = L;
int hi = N - 1;
int bst = -1;
int beat = 0;
if(L > 0) beat = pre[L-1];
while(lo <= hi){
int mid = (lo + hi) / 2;
if(pre[mid] > beat){
bst = mid;
hi = mid - 1;
}else lo = mid + 1;
}
assert(bst != -1);
return bst;
}
int get_last(int R, vector<int>& pre){
int lo = 0;
int hi = R;
int bst = -1;
while(lo <= hi){
int mid = (lo + hi) / 2;
if(pre[mid] <= pre[R] - 1){
bst = mid;
lo = mid + 1;
}else hi = mid - 1;
}
return bst + 1;
}
void init(int n, vector<int> H1) {
N = n;
H = H1;
first = 1;
precalcmx();
precalcmn();
precalclw();
}
int dnc(int L, int R, int D) {
if(L == R) {
return H[L];
}else if(L > R){
return 2e9;
}
pair<int, int> pr = get_mx(L, R);
int mx = pr.first;
int ind = pr.second;
int mn1 = dnc(ind + 1, R, D);
int mn2 = dnc(L, ind - 1, D);
candidates.push_back({min(mx - mn1, mx - mn2), ind});
return min(mn1, mn2);
}
int max_towers(int L, int R, int D) {
if(first == 1){
dnc(0, N-1, D);
sort(candidates.begin(), candidates.end());
reverse(candidates.begin(), candidates.end());
vector<int> good(N, 0);
for(int l = 0; l < (int)candidates.size(); l += B){
for(int i = l; i < min(l + B, (int)candidates.size()); i++){
good[candidates[i].second] = 1;
}
vector<int> pre(N);
for(int i = 0; i < N; i++){
if(i == 0) pre[i] = good[i];
else pre[i] = pre[i-1] + good[i];
}
prefix.push_back(pre);
}
first = 0;
}
for(int l = 0; l < (int)candidates.size(); l += B){
int indmx = l + B - 1;
if(indmx >= (int)candidates.size()) indmx = (int)candidates.size() - 1;
if(candidates[indmx].first >= D && l < (int)candidates.size() - 1) continue;
int total = 0;
int ind1 = N;
int ind2 = -1;
if(l != 0){
int i = l / B - 1;
total = prefix[i][R];
if(L > 0) total -= prefix[i][L-1];
if(total > 0){
ind1 = get_first(L, prefix[i]);
ind2 = get_last(R, prefix[i]);
}
}
for(int i = l; candidates[i].first >= D; i++){
int ind = candidates[i].second;
if(ind >= L && ind <= R){
total++;
ind1 = min(ind1, ind);
ind2 = max(ind2, ind);
}
}
if(total == 0) return 1;
else if(total == 1){
int ind = ind1;
int mn1 = get_mn(L, ind - 1).first;
int mn2 = get_mn(ind + 1, R).first;
if(mn1 <= H[ind] - D && mn2 <= H[ind] - D) return 2;
else return 1;
}else{
int ans = total + 1;
int ind = ind1;
int mn = get_mn(L, ind - 1).first;
if(mn > H[ind] - D) ans--;
ind = ind2;
mn = get_mn(ind + 1, R).first;
if(mn > H[ind] - D) ans--;
return ans;
}
}
}
// int main() {
// int N, Q;
// assert(2 == scanf("%d %d", &N, &Q));
// std::vector<int> H(N);
// for (int i = 0; i < N; ++i) {
// assert(1 == scanf("%d", &H[i]));
// }
// init(N, H);
// for (int i = 0; i < Q; ++i) {
// int L, R, D;
// assert(3 == scanf("%d %d %d", &L, &R, &D));
// printf("%d\n", max_towers(L, R, D));
// }
// return 0;
// }
Compilation message
towers.cpp: In function 'int max_towers(int, int, int)':
towers.cpp:184:1: warning: control reaches end of non-void function [-Wreturn-type]
184 | }
| ^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
346 ms |
94480 KB |
Output is correct |
2 |
Correct |
866 ms |
237860 KB |
Output is correct |
3 |
Correct |
761 ms |
237872 KB |
Output is correct |
4 |
Correct |
843 ms |
238220 KB |
Output is correct |
5 |
Correct |
892 ms |
238276 KB |
Output is correct |
6 |
Correct |
936 ms |
238232 KB |
Output is correct |
7 |
Correct |
811 ms |
238260 KB |
Output is correct |
8 |
Correct |
0 ms |
208 KB |
Output is correct |
9 |
Correct |
1 ms |
1104 KB |
Output is correct |
10 |
Correct |
1 ms |
1104 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
1104 KB |
Output is correct |
3 |
Correct |
1 ms |
976 KB |
Output is correct |
4 |
Correct |
1 ms |
976 KB |
Output is correct |
5 |
Correct |
1 ms |
976 KB |
Output is correct |
6 |
Correct |
1 ms |
976 KB |
Output is correct |
7 |
Correct |
1 ms |
976 KB |
Output is correct |
8 |
Correct |
1 ms |
1104 KB |
Output is correct |
9 |
Correct |
1 ms |
1224 KB |
Output is correct |
10 |
Correct |
1 ms |
1104 KB |
Output is correct |
11 |
Correct |
1 ms |
1104 KB |
Output is correct |
12 |
Correct |
1 ms |
208 KB |
Output is correct |
13 |
Correct |
1 ms |
1104 KB |
Output is correct |
14 |
Correct |
1 ms |
1104 KB |
Output is correct |
15 |
Correct |
1 ms |
976 KB |
Output is correct |
16 |
Correct |
1 ms |
976 KB |
Output is correct |
17 |
Correct |
1 ms |
988 KB |
Output is correct |
18 |
Correct |
1 ms |
1104 KB |
Output is correct |
19 |
Correct |
1 ms |
1104 KB |
Output is correct |
20 |
Correct |
1 ms |
976 KB |
Output is correct |
21 |
Correct |
1 ms |
976 KB |
Output is correct |
22 |
Correct |
1 ms |
976 KB |
Output is correct |
23 |
Correct |
1 ms |
1216 KB |
Output is correct |
24 |
Correct |
1 ms |
1104 KB |
Output is correct |
25 |
Correct |
1 ms |
592 KB |
Output is correct |
26 |
Correct |
1 ms |
976 KB |
Output is correct |
27 |
Correct |
1 ms |
976 KB |
Output is correct |
28 |
Correct |
1 ms |
976 KB |
Output is correct |
29 |
Correct |
1 ms |
976 KB |
Output is correct |
30 |
Correct |
1 ms |
976 KB |
Output is correct |
31 |
Correct |
1 ms |
976 KB |
Output is correct |
32 |
Correct |
1 ms |
1104 KB |
Output is correct |
33 |
Correct |
1 ms |
1104 KB |
Output is correct |
34 |
Correct |
1 ms |
1104 KB |
Output is correct |
35 |
Correct |
1 ms |
1104 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
1104 KB |
Output is correct |
3 |
Correct |
1 ms |
976 KB |
Output is correct |
4 |
Correct |
1 ms |
976 KB |
Output is correct |
5 |
Correct |
1 ms |
976 KB |
Output is correct |
6 |
Correct |
1 ms |
976 KB |
Output is correct |
7 |
Correct |
1 ms |
976 KB |
Output is correct |
8 |
Correct |
1 ms |
1104 KB |
Output is correct |
9 |
Correct |
1 ms |
1224 KB |
Output is correct |
10 |
Correct |
1 ms |
1104 KB |
Output is correct |
11 |
Correct |
1 ms |
1104 KB |
Output is correct |
12 |
Correct |
1 ms |
208 KB |
Output is correct |
13 |
Correct |
1 ms |
1104 KB |
Output is correct |
14 |
Correct |
1 ms |
1104 KB |
Output is correct |
15 |
Correct |
1 ms |
976 KB |
Output is correct |
16 |
Correct |
1 ms |
976 KB |
Output is correct |
17 |
Correct |
1 ms |
988 KB |
Output is correct |
18 |
Correct |
1 ms |
1104 KB |
Output is correct |
19 |
Correct |
1 ms |
1104 KB |
Output is correct |
20 |
Correct |
1 ms |
976 KB |
Output is correct |
21 |
Correct |
1 ms |
976 KB |
Output is correct |
22 |
Correct |
1 ms |
976 KB |
Output is correct |
23 |
Correct |
1 ms |
1216 KB |
Output is correct |
24 |
Correct |
1 ms |
1104 KB |
Output is correct |
25 |
Correct |
1 ms |
592 KB |
Output is correct |
26 |
Correct |
1 ms |
976 KB |
Output is correct |
27 |
Correct |
1 ms |
976 KB |
Output is correct |
28 |
Correct |
1 ms |
976 KB |
Output is correct |
29 |
Correct |
1 ms |
976 KB |
Output is correct |
30 |
Correct |
1 ms |
976 KB |
Output is correct |
31 |
Correct |
1 ms |
976 KB |
Output is correct |
32 |
Correct |
1 ms |
1104 KB |
Output is correct |
33 |
Correct |
1 ms |
1104 KB |
Output is correct |
34 |
Correct |
1 ms |
1104 KB |
Output is correct |
35 |
Correct |
1 ms |
1104 KB |
Output is correct |
36 |
Correct |
78 ms |
78120 KB |
Output is correct |
37 |
Correct |
167 ms |
164840 KB |
Output is correct |
38 |
Correct |
163 ms |
165260 KB |
Output is correct |
39 |
Correct |
129 ms |
132440 KB |
Output is correct |
40 |
Correct |
132 ms |
132784 KB |
Output is correct |
41 |
Correct |
133 ms |
132496 KB |
Output is correct |
42 |
Correct |
130 ms |
132452 KB |
Output is correct |
43 |
Correct |
221 ms |
238204 KB |
Output is correct |
44 |
Correct |
223 ms |
238256 KB |
Output is correct |
45 |
Correct |
228 ms |
236132 KB |
Output is correct |
46 |
Correct |
234 ms |
235328 KB |
Output is correct |
47 |
Correct |
165 ms |
165164 KB |
Output is correct |
48 |
Correct |
132 ms |
132400 KB |
Output is correct |
49 |
Correct |
136 ms |
132892 KB |
Output is correct |
50 |
Correct |
226 ms |
238272 KB |
Output is correct |
51 |
Correct |
229 ms |
238100 KB |
Output is correct |
52 |
Correct |
163 ms |
165140 KB |
Output is correct |
53 |
Correct |
130 ms |
132500 KB |
Output is correct |
54 |
Correct |
130 ms |
132832 KB |
Output is correct |
55 |
Correct |
245 ms |
238252 KB |
Output is correct |
56 |
Correct |
229 ms |
237488 KB |
Output is correct |
57 |
Correct |
156 ms |
155316 KB |
Output is correct |
58 |
Correct |
163 ms |
165236 KB |
Output is correct |
59 |
Correct |
164 ms |
164816 KB |
Output is correct |
60 |
Correct |
129 ms |
132512 KB |
Output is correct |
61 |
Correct |
134 ms |
132496 KB |
Output is correct |
62 |
Correct |
138 ms |
132424 KB |
Output is correct |
63 |
Correct |
131 ms |
132868 KB |
Output is correct |
64 |
Correct |
222 ms |
238228 KB |
Output is correct |
65 |
Correct |
317 ms |
238316 KB |
Output is correct |
66 |
Correct |
234 ms |
235156 KB |
Output is correct |
67 |
Correct |
229 ms |
237812 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
727 ms |
163168 KB |
Output is correct |
2 |
Correct |
901 ms |
165264 KB |
Output is correct |
3 |
Correct |
942 ms |
165224 KB |
Output is correct |
4 |
Correct |
926 ms |
132428 KB |
Output is correct |
5 |
Correct |
1006 ms |
132512 KB |
Output is correct |
6 |
Correct |
740 ms |
132464 KB |
Output is correct |
7 |
Correct |
1088 ms |
132808 KB |
Output is correct |
8 |
Correct |
1047 ms |
238260 KB |
Output is correct |
9 |
Correct |
910 ms |
238272 KB |
Output is correct |
10 |
Correct |
857 ms |
236328 KB |
Output is correct |
11 |
Correct |
912 ms |
236288 KB |
Output is correct |
12 |
Correct |
902 ms |
238132 KB |
Output is correct |
13 |
Correct |
755 ms |
238236 KB |
Output is correct |
14 |
Correct |
0 ms |
208 KB |
Output is correct |
15 |
Correct |
1 ms |
1104 KB |
Output is correct |
16 |
Correct |
1 ms |
1104 KB |
Output is correct |
17 |
Correct |
164 ms |
165216 KB |
Output is correct |
18 |
Correct |
132 ms |
132500 KB |
Output is correct |
19 |
Correct |
133 ms |
132784 KB |
Output is correct |
20 |
Correct |
223 ms |
238256 KB |
Output is correct |
21 |
Correct |
231 ms |
238092 KB |
Output is correct |
22 |
Correct |
167 ms |
165140 KB |
Output is correct |
23 |
Correct |
134 ms |
132500 KB |
Output is correct |
24 |
Correct |
134 ms |
132780 KB |
Output is correct |
25 |
Correct |
223 ms |
238276 KB |
Output is correct |
26 |
Correct |
249 ms |
237560 KB |
Output is correct |
27 |
Correct |
1 ms |
976 KB |
Output is correct |
28 |
Correct |
1 ms |
976 KB |
Output is correct |
29 |
Correct |
1 ms |
976 KB |
Output is correct |
30 |
Correct |
1 ms |
1104 KB |
Output is correct |
31 |
Correct |
1 ms |
1104 KB |
Output is correct |
32 |
Correct |
1 ms |
976 KB |
Output is correct |
33 |
Correct |
1 ms |
976 KB |
Output is correct |
34 |
Correct |
1 ms |
976 KB |
Output is correct |
35 |
Correct |
1 ms |
1104 KB |
Output is correct |
36 |
Correct |
1 ms |
1104 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
252 ms |
15968 KB |
Output is correct |
2 |
Correct |
752 ms |
165192 KB |
Output is correct |
3 |
Correct |
901 ms |
165168 KB |
Output is correct |
4 |
Correct |
950 ms |
132412 KB |
Output is correct |
5 |
Correct |
803 ms |
132852 KB |
Output is correct |
6 |
Correct |
807 ms |
132448 KB |
Output is correct |
7 |
Correct |
943 ms |
132432 KB |
Output is correct |
8 |
Correct |
795 ms |
238288 KB |
Output is correct |
9 |
Correct |
1107 ms |
238256 KB |
Output is correct |
10 |
Correct |
959 ms |
235284 KB |
Output is correct |
11 |
Correct |
914 ms |
235780 KB |
Output is correct |
12 |
Correct |
179 ms |
165140 KB |
Output is correct |
13 |
Correct |
132 ms |
132448 KB |
Output is correct |
14 |
Correct |
143 ms |
132880 KB |
Output is correct |
15 |
Correct |
228 ms |
238400 KB |
Output is correct |
16 |
Correct |
234 ms |
237592 KB |
Output is correct |
17 |
Correct |
166 ms |
155240 KB |
Output is correct |
18 |
Correct |
175 ms |
165148 KB |
Output is correct |
19 |
Correct |
166 ms |
164868 KB |
Output is correct |
20 |
Correct |
133 ms |
132440 KB |
Output is correct |
21 |
Correct |
141 ms |
132456 KB |
Output is correct |
22 |
Correct |
136 ms |
132492 KB |
Output is correct |
23 |
Correct |
141 ms |
132832 KB |
Output is correct |
24 |
Correct |
228 ms |
238232 KB |
Output is correct |
25 |
Correct |
232 ms |
238212 KB |
Output is correct |
26 |
Correct |
226 ms |
235160 KB |
Output is correct |
27 |
Correct |
230 ms |
237796 KB |
Output is correct |
28 |
Correct |
2 ms |
984 KB |
Output is correct |
29 |
Correct |
1 ms |
976 KB |
Output is correct |
30 |
Correct |
1 ms |
976 KB |
Output is correct |
31 |
Correct |
1 ms |
1104 KB |
Output is correct |
32 |
Correct |
1 ms |
1104 KB |
Output is correct |
33 |
Correct |
1 ms |
592 KB |
Output is correct |
34 |
Correct |
1 ms |
976 KB |
Output is correct |
35 |
Correct |
1 ms |
976 KB |
Output is correct |
36 |
Correct |
1 ms |
976 KB |
Output is correct |
37 |
Correct |
1 ms |
976 KB |
Output is correct |
38 |
Correct |
1 ms |
976 KB |
Output is correct |
39 |
Correct |
1 ms |
976 KB |
Output is correct |
40 |
Correct |
1 ms |
1104 KB |
Output is correct |
41 |
Correct |
1 ms |
1104 KB |
Output is correct |
42 |
Correct |
1 ms |
1104 KB |
Output is correct |
43 |
Correct |
1 ms |
1104 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
1104 KB |
Output is correct |
3 |
Correct |
1 ms |
976 KB |
Output is correct |
4 |
Correct |
1 ms |
976 KB |
Output is correct |
5 |
Correct |
1 ms |
976 KB |
Output is correct |
6 |
Correct |
1 ms |
976 KB |
Output is correct |
7 |
Correct |
1 ms |
976 KB |
Output is correct |
8 |
Correct |
1 ms |
1104 KB |
Output is correct |
9 |
Correct |
1 ms |
1224 KB |
Output is correct |
10 |
Correct |
1 ms |
1104 KB |
Output is correct |
11 |
Correct |
1 ms |
1104 KB |
Output is correct |
12 |
Correct |
1 ms |
208 KB |
Output is correct |
13 |
Correct |
1 ms |
1104 KB |
Output is correct |
14 |
Correct |
1 ms |
1104 KB |
Output is correct |
15 |
Correct |
1 ms |
976 KB |
Output is correct |
16 |
Correct |
1 ms |
976 KB |
Output is correct |
17 |
Correct |
1 ms |
988 KB |
Output is correct |
18 |
Correct |
1 ms |
1104 KB |
Output is correct |
19 |
Correct |
1 ms |
1104 KB |
Output is correct |
20 |
Correct |
1 ms |
976 KB |
Output is correct |
21 |
Correct |
1 ms |
976 KB |
Output is correct |
22 |
Correct |
1 ms |
976 KB |
Output is correct |
23 |
Correct |
1 ms |
1216 KB |
Output is correct |
24 |
Correct |
1 ms |
1104 KB |
Output is correct |
25 |
Correct |
1 ms |
592 KB |
Output is correct |
26 |
Correct |
1 ms |
976 KB |
Output is correct |
27 |
Correct |
1 ms |
976 KB |
Output is correct |
28 |
Correct |
1 ms |
976 KB |
Output is correct |
29 |
Correct |
1 ms |
976 KB |
Output is correct |
30 |
Correct |
1 ms |
976 KB |
Output is correct |
31 |
Correct |
1 ms |
976 KB |
Output is correct |
32 |
Correct |
1 ms |
1104 KB |
Output is correct |
33 |
Correct |
1 ms |
1104 KB |
Output is correct |
34 |
Correct |
1 ms |
1104 KB |
Output is correct |
35 |
Correct |
1 ms |
1104 KB |
Output is correct |
36 |
Correct |
78 ms |
78120 KB |
Output is correct |
37 |
Correct |
167 ms |
164840 KB |
Output is correct |
38 |
Correct |
163 ms |
165260 KB |
Output is correct |
39 |
Correct |
129 ms |
132440 KB |
Output is correct |
40 |
Correct |
132 ms |
132784 KB |
Output is correct |
41 |
Correct |
133 ms |
132496 KB |
Output is correct |
42 |
Correct |
130 ms |
132452 KB |
Output is correct |
43 |
Correct |
221 ms |
238204 KB |
Output is correct |
44 |
Correct |
223 ms |
238256 KB |
Output is correct |
45 |
Correct |
228 ms |
236132 KB |
Output is correct |
46 |
Correct |
234 ms |
235328 KB |
Output is correct |
47 |
Correct |
165 ms |
165164 KB |
Output is correct |
48 |
Correct |
132 ms |
132400 KB |
Output is correct |
49 |
Correct |
136 ms |
132892 KB |
Output is correct |
50 |
Correct |
226 ms |
238272 KB |
Output is correct |
51 |
Correct |
229 ms |
238100 KB |
Output is correct |
52 |
Correct |
163 ms |
165140 KB |
Output is correct |
53 |
Correct |
130 ms |
132500 KB |
Output is correct |
54 |
Correct |
130 ms |
132832 KB |
Output is correct |
55 |
Correct |
245 ms |
238252 KB |
Output is correct |
56 |
Correct |
229 ms |
237488 KB |
Output is correct |
57 |
Correct |
156 ms |
155316 KB |
Output is correct |
58 |
Correct |
163 ms |
165236 KB |
Output is correct |
59 |
Correct |
164 ms |
164816 KB |
Output is correct |
60 |
Correct |
129 ms |
132512 KB |
Output is correct |
61 |
Correct |
134 ms |
132496 KB |
Output is correct |
62 |
Correct |
138 ms |
132424 KB |
Output is correct |
63 |
Correct |
131 ms |
132868 KB |
Output is correct |
64 |
Correct |
222 ms |
238228 KB |
Output is correct |
65 |
Correct |
317 ms |
238316 KB |
Output is correct |
66 |
Correct |
234 ms |
235156 KB |
Output is correct |
67 |
Correct |
229 ms |
237812 KB |
Output is correct |
68 |
Correct |
727 ms |
163168 KB |
Output is correct |
69 |
Correct |
901 ms |
165264 KB |
Output is correct |
70 |
Correct |
942 ms |
165224 KB |
Output is correct |
71 |
Correct |
926 ms |
132428 KB |
Output is correct |
72 |
Correct |
1006 ms |
132512 KB |
Output is correct |
73 |
Correct |
740 ms |
132464 KB |
Output is correct |
74 |
Correct |
1088 ms |
132808 KB |
Output is correct |
75 |
Correct |
1047 ms |
238260 KB |
Output is correct |
76 |
Correct |
910 ms |
238272 KB |
Output is correct |
77 |
Correct |
857 ms |
236328 KB |
Output is correct |
78 |
Correct |
912 ms |
236288 KB |
Output is correct |
79 |
Correct |
902 ms |
238132 KB |
Output is correct |
80 |
Correct |
755 ms |
238236 KB |
Output is correct |
81 |
Correct |
0 ms |
208 KB |
Output is correct |
82 |
Correct |
1 ms |
1104 KB |
Output is correct |
83 |
Correct |
1 ms |
1104 KB |
Output is correct |
84 |
Correct |
164 ms |
165216 KB |
Output is correct |
85 |
Correct |
132 ms |
132500 KB |
Output is correct |
86 |
Correct |
133 ms |
132784 KB |
Output is correct |
87 |
Correct |
223 ms |
238256 KB |
Output is correct |
88 |
Correct |
231 ms |
238092 KB |
Output is correct |
89 |
Correct |
167 ms |
165140 KB |
Output is correct |
90 |
Correct |
134 ms |
132500 KB |
Output is correct |
91 |
Correct |
134 ms |
132780 KB |
Output is correct |
92 |
Correct |
223 ms |
238276 KB |
Output is correct |
93 |
Correct |
249 ms |
237560 KB |
Output is correct |
94 |
Correct |
1 ms |
976 KB |
Output is correct |
95 |
Correct |
1 ms |
976 KB |
Output is correct |
96 |
Correct |
1 ms |
976 KB |
Output is correct |
97 |
Correct |
1 ms |
1104 KB |
Output is correct |
98 |
Correct |
1 ms |
1104 KB |
Output is correct |
99 |
Correct |
1 ms |
976 KB |
Output is correct |
100 |
Correct |
1 ms |
976 KB |
Output is correct |
101 |
Correct |
1 ms |
976 KB |
Output is correct |
102 |
Correct |
1 ms |
1104 KB |
Output is correct |
103 |
Correct |
1 ms |
1104 KB |
Output is correct |
104 |
Correct |
832 ms |
133712 KB |
Output is correct |
105 |
Correct |
1134 ms |
165148 KB |
Output is correct |
106 |
Correct |
930 ms |
164748 KB |
Output is correct |
107 |
Correct |
725 ms |
132420 KB |
Output is correct |
108 |
Correct |
1029 ms |
132504 KB |
Output is correct |
109 |
Correct |
819 ms |
132420 KB |
Output is correct |
110 |
Correct |
1052 ms |
132872 KB |
Output is correct |
111 |
Correct |
1046 ms |
238308 KB |
Output is correct |
112 |
Correct |
827 ms |
238272 KB |
Output is correct |
113 |
Correct |
915 ms |
236596 KB |
Output is correct |
114 |
Correct |
854 ms |
234088 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
346 ms |
94480 KB |
Output is correct |
2 |
Correct |
866 ms |
237860 KB |
Output is correct |
3 |
Correct |
761 ms |
237872 KB |
Output is correct |
4 |
Correct |
843 ms |
238220 KB |
Output is correct |
5 |
Correct |
892 ms |
238276 KB |
Output is correct |
6 |
Correct |
936 ms |
238232 KB |
Output is correct |
7 |
Correct |
811 ms |
238260 KB |
Output is correct |
8 |
Correct |
0 ms |
208 KB |
Output is correct |
9 |
Correct |
1 ms |
1104 KB |
Output is correct |
10 |
Correct |
1 ms |
1104 KB |
Output is correct |
11 |
Correct |
0 ms |
336 KB |
Output is correct |
12 |
Correct |
1 ms |
1104 KB |
Output is correct |
13 |
Correct |
1 ms |
976 KB |
Output is correct |
14 |
Correct |
1 ms |
976 KB |
Output is correct |
15 |
Correct |
1 ms |
976 KB |
Output is correct |
16 |
Correct |
1 ms |
976 KB |
Output is correct |
17 |
Correct |
1 ms |
976 KB |
Output is correct |
18 |
Correct |
1 ms |
1104 KB |
Output is correct |
19 |
Correct |
1 ms |
1224 KB |
Output is correct |
20 |
Correct |
1 ms |
1104 KB |
Output is correct |
21 |
Correct |
1 ms |
1104 KB |
Output is correct |
22 |
Correct |
1 ms |
208 KB |
Output is correct |
23 |
Correct |
1 ms |
1104 KB |
Output is correct |
24 |
Correct |
1 ms |
1104 KB |
Output is correct |
25 |
Correct |
1 ms |
976 KB |
Output is correct |
26 |
Correct |
1 ms |
976 KB |
Output is correct |
27 |
Correct |
1 ms |
988 KB |
Output is correct |
28 |
Correct |
1 ms |
1104 KB |
Output is correct |
29 |
Correct |
1 ms |
1104 KB |
Output is correct |
30 |
Correct |
1 ms |
976 KB |
Output is correct |
31 |
Correct |
1 ms |
976 KB |
Output is correct |
32 |
Correct |
1 ms |
976 KB |
Output is correct |
33 |
Correct |
1 ms |
1216 KB |
Output is correct |
34 |
Correct |
1 ms |
1104 KB |
Output is correct |
35 |
Correct |
1 ms |
592 KB |
Output is correct |
36 |
Correct |
1 ms |
976 KB |
Output is correct |
37 |
Correct |
1 ms |
976 KB |
Output is correct |
38 |
Correct |
1 ms |
976 KB |
Output is correct |
39 |
Correct |
1 ms |
976 KB |
Output is correct |
40 |
Correct |
1 ms |
976 KB |
Output is correct |
41 |
Correct |
1 ms |
976 KB |
Output is correct |
42 |
Correct |
1 ms |
1104 KB |
Output is correct |
43 |
Correct |
1 ms |
1104 KB |
Output is correct |
44 |
Correct |
1 ms |
1104 KB |
Output is correct |
45 |
Correct |
1 ms |
1104 KB |
Output is correct |
46 |
Correct |
78 ms |
78120 KB |
Output is correct |
47 |
Correct |
167 ms |
164840 KB |
Output is correct |
48 |
Correct |
163 ms |
165260 KB |
Output is correct |
49 |
Correct |
129 ms |
132440 KB |
Output is correct |
50 |
Correct |
132 ms |
132784 KB |
Output is correct |
51 |
Correct |
133 ms |
132496 KB |
Output is correct |
52 |
Correct |
130 ms |
132452 KB |
Output is correct |
53 |
Correct |
221 ms |
238204 KB |
Output is correct |
54 |
Correct |
223 ms |
238256 KB |
Output is correct |
55 |
Correct |
228 ms |
236132 KB |
Output is correct |
56 |
Correct |
234 ms |
235328 KB |
Output is correct |
57 |
Correct |
165 ms |
165164 KB |
Output is correct |
58 |
Correct |
132 ms |
132400 KB |
Output is correct |
59 |
Correct |
136 ms |
132892 KB |
Output is correct |
60 |
Correct |
226 ms |
238272 KB |
Output is correct |
61 |
Correct |
229 ms |
238100 KB |
Output is correct |
62 |
Correct |
163 ms |
165140 KB |
Output is correct |
63 |
Correct |
130 ms |
132500 KB |
Output is correct |
64 |
Correct |
130 ms |
132832 KB |
Output is correct |
65 |
Correct |
245 ms |
238252 KB |
Output is correct |
66 |
Correct |
229 ms |
237488 KB |
Output is correct |
67 |
Correct |
156 ms |
155316 KB |
Output is correct |
68 |
Correct |
163 ms |
165236 KB |
Output is correct |
69 |
Correct |
164 ms |
164816 KB |
Output is correct |
70 |
Correct |
129 ms |
132512 KB |
Output is correct |
71 |
Correct |
134 ms |
132496 KB |
Output is correct |
72 |
Correct |
138 ms |
132424 KB |
Output is correct |
73 |
Correct |
131 ms |
132868 KB |
Output is correct |
74 |
Correct |
222 ms |
238228 KB |
Output is correct |
75 |
Correct |
317 ms |
238316 KB |
Output is correct |
76 |
Correct |
234 ms |
235156 KB |
Output is correct |
77 |
Correct |
229 ms |
237812 KB |
Output is correct |
78 |
Correct |
727 ms |
163168 KB |
Output is correct |
79 |
Correct |
901 ms |
165264 KB |
Output is correct |
80 |
Correct |
942 ms |
165224 KB |
Output is correct |
81 |
Correct |
926 ms |
132428 KB |
Output is correct |
82 |
Correct |
1006 ms |
132512 KB |
Output is correct |
83 |
Correct |
740 ms |
132464 KB |
Output is correct |
84 |
Correct |
1088 ms |
132808 KB |
Output is correct |
85 |
Correct |
1047 ms |
238260 KB |
Output is correct |
86 |
Correct |
910 ms |
238272 KB |
Output is correct |
87 |
Correct |
857 ms |
236328 KB |
Output is correct |
88 |
Correct |
912 ms |
236288 KB |
Output is correct |
89 |
Correct |
902 ms |
238132 KB |
Output is correct |
90 |
Correct |
755 ms |
238236 KB |
Output is correct |
91 |
Correct |
0 ms |
208 KB |
Output is correct |
92 |
Correct |
1 ms |
1104 KB |
Output is correct |
93 |
Correct |
1 ms |
1104 KB |
Output is correct |
94 |
Correct |
164 ms |
165216 KB |
Output is correct |
95 |
Correct |
132 ms |
132500 KB |
Output is correct |
96 |
Correct |
133 ms |
132784 KB |
Output is correct |
97 |
Correct |
223 ms |
238256 KB |
Output is correct |
98 |
Correct |
231 ms |
238092 KB |
Output is correct |
99 |
Correct |
167 ms |
165140 KB |
Output is correct |
100 |
Correct |
134 ms |
132500 KB |
Output is correct |
101 |
Correct |
134 ms |
132780 KB |
Output is correct |
102 |
Correct |
223 ms |
238276 KB |
Output is correct |
103 |
Correct |
249 ms |
237560 KB |
Output is correct |
104 |
Correct |
1 ms |
976 KB |
Output is correct |
105 |
Correct |
1 ms |
976 KB |
Output is correct |
106 |
Correct |
1 ms |
976 KB |
Output is correct |
107 |
Correct |
1 ms |
1104 KB |
Output is correct |
108 |
Correct |
1 ms |
1104 KB |
Output is correct |
109 |
Correct |
1 ms |
976 KB |
Output is correct |
110 |
Correct |
1 ms |
976 KB |
Output is correct |
111 |
Correct |
1 ms |
976 KB |
Output is correct |
112 |
Correct |
1 ms |
1104 KB |
Output is correct |
113 |
Correct |
1 ms |
1104 KB |
Output is correct |
114 |
Correct |
252 ms |
15968 KB |
Output is correct |
115 |
Correct |
752 ms |
165192 KB |
Output is correct |
116 |
Correct |
901 ms |
165168 KB |
Output is correct |
117 |
Correct |
950 ms |
132412 KB |
Output is correct |
118 |
Correct |
803 ms |
132852 KB |
Output is correct |
119 |
Correct |
807 ms |
132448 KB |
Output is correct |
120 |
Correct |
943 ms |
132432 KB |
Output is correct |
121 |
Correct |
795 ms |
238288 KB |
Output is correct |
122 |
Correct |
1107 ms |
238256 KB |
Output is correct |
123 |
Correct |
959 ms |
235284 KB |
Output is correct |
124 |
Correct |
914 ms |
235780 KB |
Output is correct |
125 |
Correct |
179 ms |
165140 KB |
Output is correct |
126 |
Correct |
132 ms |
132448 KB |
Output is correct |
127 |
Correct |
143 ms |
132880 KB |
Output is correct |
128 |
Correct |
228 ms |
238400 KB |
Output is correct |
129 |
Correct |
234 ms |
237592 KB |
Output is correct |
130 |
Correct |
166 ms |
155240 KB |
Output is correct |
131 |
Correct |
175 ms |
165148 KB |
Output is correct |
132 |
Correct |
166 ms |
164868 KB |
Output is correct |
133 |
Correct |
133 ms |
132440 KB |
Output is correct |
134 |
Correct |
141 ms |
132456 KB |
Output is correct |
135 |
Correct |
136 ms |
132492 KB |
Output is correct |
136 |
Correct |
141 ms |
132832 KB |
Output is correct |
137 |
Correct |
228 ms |
238232 KB |
Output is correct |
138 |
Correct |
232 ms |
238212 KB |
Output is correct |
139 |
Correct |
226 ms |
235160 KB |
Output is correct |
140 |
Correct |
230 ms |
237796 KB |
Output is correct |
141 |
Correct |
2 ms |
984 KB |
Output is correct |
142 |
Correct |
1 ms |
976 KB |
Output is correct |
143 |
Correct |
1 ms |
976 KB |
Output is correct |
144 |
Correct |
1 ms |
1104 KB |
Output is correct |
145 |
Correct |
1 ms |
1104 KB |
Output is correct |
146 |
Correct |
1 ms |
592 KB |
Output is correct |
147 |
Correct |
1 ms |
976 KB |
Output is correct |
148 |
Correct |
1 ms |
976 KB |
Output is correct |
149 |
Correct |
1 ms |
976 KB |
Output is correct |
150 |
Correct |
1 ms |
976 KB |
Output is correct |
151 |
Correct |
1 ms |
976 KB |
Output is correct |
152 |
Correct |
1 ms |
976 KB |
Output is correct |
153 |
Correct |
1 ms |
1104 KB |
Output is correct |
154 |
Correct |
1 ms |
1104 KB |
Output is correct |
155 |
Correct |
1 ms |
1104 KB |
Output is correct |
156 |
Correct |
1 ms |
1104 KB |
Output is correct |
157 |
Correct |
832 ms |
133712 KB |
Output is correct |
158 |
Correct |
1134 ms |
165148 KB |
Output is correct |
159 |
Correct |
930 ms |
164748 KB |
Output is correct |
160 |
Correct |
725 ms |
132420 KB |
Output is correct |
161 |
Correct |
1029 ms |
132504 KB |
Output is correct |
162 |
Correct |
819 ms |
132420 KB |
Output is correct |
163 |
Correct |
1052 ms |
132872 KB |
Output is correct |
164 |
Correct |
1046 ms |
238308 KB |
Output is correct |
165 |
Correct |
827 ms |
238272 KB |
Output is correct |
166 |
Correct |
915 ms |
236596 KB |
Output is correct |
167 |
Correct |
854 ms |
234088 KB |
Output is correct |
168 |
Correct |
0 ms |
208 KB |
Output is correct |
169 |
Correct |
578 ms |
27932 KB |
Output is correct |
170 |
Correct |
905 ms |
165596 KB |
Output is correct |
171 |
Correct |
989 ms |
165200 KB |
Output is correct |
172 |
Correct |
994 ms |
132488 KB |
Output is correct |
173 |
Correct |
1004 ms |
132864 KB |
Output is correct |
174 |
Correct |
934 ms |
132428 KB |
Output is correct |
175 |
Correct |
1036 ms |
132428 KB |
Output is correct |
176 |
Correct |
672 ms |
238204 KB |
Output is correct |
177 |
Correct |
966 ms |
238232 KB |
Output is correct |
178 |
Correct |
897 ms |
235388 KB |
Output is correct |
179 |
Correct |
1016 ms |
237980 KB |
Output is correct |