// #pragma once
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pii pair<int, int>
#define all(c) ((c).begin()), ((c).end())
#define sz(x) ((int)(x).size())
#ifdef LOCAL
#include <print.h>
#else
#define trace(...)
#define endl "\n" // remove in interactive
#endif
const int MAX = 1000000000;
const int LOG = 18;
struct Node{
Node* lft, *rgt;
int sum;
Node(){lft = rgt = NULL; sum = 0;}
};
Node* add(Node* rt, int x, int s = 0, int e = MAX){
Node* rt2 = new Node();
Node* ret = rt2;
while(true){
rt2->sum = (rt ? rt->sum: 0) + 1;
if(s == e) break;
int mid = (s + e) / 2;
if(x <= mid){
rt2->rgt = rt ? rt->rgt: NULL;
rt2->lft = new Node();
rt2 = rt2->lft;
if(rt) rt = rt->lft;
e = mid;
} else{
rt2->lft = rt ? rt->lft: NULL;
rt2->rgt = new Node();
rt2 = rt2->rgt;
if(rt) rt = rt->rgt;
s = mid + 1;
}
}
return ret;
}
int getNum(Node* rt, int L, int R, int s = 0, int e = MAX){
if(!rt) return 0;
if(L > e || R < s) return 0;
if(s >= L && e <= R) return rt->sum;
int mid = (s + e) >> 1;
return getNum(rt->lft, L, R, s, mid) + getNum(rt->rgt, L, R, mid + 1, e);
}
// 0-indexed
template<class T>
struct sparse_table{
vector<vector<T>> arr;
vector<int> floorlog;
function<T(T, T)> func;
int n;
sparse_table(){}
sparse_table(vector<T> & vec, function<T(T, T)> f) : n(sz(vec)), floorlog(sz(vec) + 1), func(f){
for(int i = 0; (1 << i) <= n; i++){
for(int j = (1 << i); j < (1 << (i + 1)) && j <= n; j++)
floorlog[j] = i;
}
arr.assign(floorlog[n] + 1, vector<T>(n));
for(int i = n - 1; i >= 0; i--){
arr[0][i] = vec[i];
for(int j = 1; i + (1 << j) <= n; j++){
arr[j][i] = func(arr[j - 1][i], arr[j - 1][i + (1 << (j - 1))]);
}
}
}
T get(int i, int j){
int k = floorlog[j - i + 1];
return func(arr[k][i], arr[k][j - (1 << k) + 1]);
}
};
struct Tree{
int n;
vector<Node*> root_seg;
vector<vector<int>> jump;
vector<int> par;
Tree(){}
Tree(int n): n(n), par(n+1), root_seg(n+1, NULL){}
void get_jumps(){
root_seg[n] = new Node();
jump.resize(LOG);
par[n] = n;
jump[0] = par;
for(int i = 0; i < n; i++) if(jump[0][i] == -1) jump[0][i] = n;
jump[0][n] = n;
for(int j = 1; j < LOG; j++){
jump[j].resize(n + 1);
for(int i = 0; i <= n; i++) jump[j][i] = jump[j - 1][jump[j - 1][i]];
}
}
};
// global variables
vector<int> H, V;
sparse_table<int> st, st_ind;
Tree TL, TR, T0;
int n;
int getMin(int L, int R){
if(L > R)swap(L, R);
return st.get(L, R);
}
void init(int N, std::vector<int> HH){
H = HH;
H.push_back(MAX+10);
n = N;
vector<int> ids(n);
iota(ids.begin(), ids.end(), 0);
st = sparse_table<int>(H, [](int i, int j){return min(i, j);});
st_ind = sparse_table<int>(ids, [](int i, int j){return H[i] > H[j] ? i : j;});
TL = Tree(n); TR = Tree(n);
T0 = Tree(n);
stack<int> stk;
Node* zero = new Node();
for(int i = 0; i < n; i++){
while(!stk.empty() && H[stk.top()] < H[i]) stk.pop();
TL.par[i] = stk.empty() ? -1: stk.top();
stk.push(i);
}
while(!stk.empty()) stk.pop();
for(int i = n - 1; i >= 0; i--){
while(!stk.empty() && H[stk.top()] < H[i]) stk.pop();
TR.par[i] = stk.empty() ? n: stk.top();
stk.push(i);
}
V.resize(n);
for(int i = 0; i < n; i++){
int L = TL.par[i], R = TR.par[i];
int mn = max(getMin(L + 1, i), getMin(i, R - 1));
int D_max = max(0, H[i] - mn);
V[i] = D_max;
T0.root_seg[i] = add(i == 0 ? zero: T0.root_seg[i - 1], D_max);
TL.root_seg[i] = add(TL.par[i] == -1 ? zero: TL.root_seg[TL.par[i]], D_max);
}
for(int i = n - 1; i >= 0; i--){
TR.root_seg[i] = add(TR.par[i] == n ? zero: TR.root_seg[TR.par[i]], V[i]);
}
TL.get_jumps(); TR.get_jumps();
}
int fix_seq(const Tree& T, int mx_H, int i, int D){
// sequence i -> par[i] -> .. till height < mx_H
// subtract for those j in this sequence where getMin(i, j) > H[j] - D
if(H[i] >= mx_H) return 0;
int j = i;
for(int k = LOG - 1; k >= 0; k--){
int p = T.jump[k][j];
if(H[p] < mx_H && getMin(i, p) > H[p] - D) j = p;
}
j = T.jump[0][j];
return getNum(T.root_seg[i], D, MAX) - getNum(T.root_seg[j], D, MAX);
}
int max_towers(int L, int R, int D){
int ret = 1 + getNum(T0.root_seg[R], D, MAX) - (L == 0 ? 0: getNum(T0.root_seg[L - 1], D, MAX));
int mx = st_ind.get(L, R);
ret -= V[mx] >= D;
ret += H[mx] - max(getMin(L, mx), getMin(mx, R)) >= D;
ret -= fix_seq(TR, H[mx], L, D);
ret -= fix_seq(TL, H[mx], R, D);
return ret;
}
Compilation message
towers.cpp: In constructor 'Tree::Tree(int)':
towers.cpp:91:17: warning: 'Tree::par' will be initialized after [-Wreorder]
91 | vector<int> par;
| ^~~
towers.cpp:89:19: warning: 'std::vector<Node*> Tree::root_seg' [-Wreorder]
89 | vector<Node*> root_seg;
| ^~~~~~~~
towers.cpp:93:5: warning: when initialized here [-Wreorder]
93 | Tree(int n): n(n), par(n+1), root_seg(n+1, NULL){}
| ^~~~
towers.cpp: In instantiation of 'sparse_table<T>::sparse_table(std::vector<_Tp>&, std::function<T(T, T)>) [with T = int]':
towers.cpp:124:66: required from here
towers.cpp:64:9: warning: 'sparse_table<int>::n' will be initialized after [-Wreorder]
64 | int n;
| ^
towers.cpp:62:17: warning: 'std::vector<int> sparse_table<int>::floorlog' [-Wreorder]
62 | vector<int> floorlog;
| ^~~~~~~~
towers.cpp:66:5: warning: when initialized here [-Wreorder]
66 | sparse_table(vector<T> & vec, function<T(T, T)> f) : n(sz(vec)), floorlog(sz(vec) + 1), func(f){
| ^~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
602 ms |
193744 KB |
Output is correct |
2 |
Correct |
1375 ms |
325444 KB |
Output is correct |
3 |
Correct |
1299 ms |
325528 KB |
Output is correct |
4 |
Correct |
1437 ms |
325600 KB |
Output is correct |
5 |
Correct |
1362 ms |
325068 KB |
Output is correct |
6 |
Correct |
1528 ms |
325544 KB |
Output is correct |
7 |
Correct |
1486 ms |
325104 KB |
Output is correct |
8 |
Correct |
0 ms |
208 KB |
Output is correct |
9 |
Correct |
7 ms |
6600 KB |
Output is correct |
10 |
Correct |
7 ms |
6576 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
1616 KB |
Output is correct |
2 |
Correct |
7 ms |
6608 KB |
Output is correct |
3 |
Correct |
7 ms |
6700 KB |
Output is correct |
4 |
Correct |
7 ms |
6608 KB |
Output is correct |
5 |
Correct |
9 ms |
6608 KB |
Output is correct |
6 |
Correct |
8 ms |
6600 KB |
Output is correct |
7 |
Correct |
7 ms |
6608 KB |
Output is correct |
8 |
Correct |
7 ms |
6608 KB |
Output is correct |
9 |
Correct |
7 ms |
6608 KB |
Output is correct |
10 |
Correct |
6 ms |
6608 KB |
Output is correct |
11 |
Correct |
8 ms |
6612 KB |
Output is correct |
12 |
Correct |
0 ms |
208 KB |
Output is correct |
13 |
Correct |
6 ms |
6608 KB |
Output is correct |
14 |
Correct |
7 ms |
6700 KB |
Output is correct |
15 |
Correct |
8 ms |
6608 KB |
Output is correct |
16 |
Correct |
8 ms |
6620 KB |
Output is correct |
17 |
Correct |
7 ms |
6608 KB |
Output is correct |
18 |
Correct |
7 ms |
6608 KB |
Output is correct |
19 |
Correct |
7 ms |
6608 KB |
Output is correct |
20 |
Correct |
7 ms |
6672 KB |
Output is correct |
21 |
Correct |
8 ms |
6608 KB |
Output is correct |
22 |
Correct |
7 ms |
6608 KB |
Output is correct |
23 |
Correct |
7 ms |
6668 KB |
Output is correct |
24 |
Correct |
7 ms |
6716 KB |
Output is correct |
25 |
Correct |
4 ms |
3152 KB |
Output is correct |
26 |
Correct |
7 ms |
6608 KB |
Output is correct |
27 |
Correct |
7 ms |
6608 KB |
Output is correct |
28 |
Correct |
8 ms |
6608 KB |
Output is correct |
29 |
Correct |
8 ms |
6608 KB |
Output is correct |
30 |
Correct |
10 ms |
6608 KB |
Output is correct |
31 |
Correct |
8 ms |
6704 KB |
Output is correct |
32 |
Correct |
7 ms |
6608 KB |
Output is correct |
33 |
Correct |
7 ms |
6632 KB |
Output is correct |
34 |
Correct |
7 ms |
6608 KB |
Output is correct |
35 |
Correct |
7 ms |
6616 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
1616 KB |
Output is correct |
2 |
Correct |
7 ms |
6608 KB |
Output is correct |
3 |
Correct |
7 ms |
6700 KB |
Output is correct |
4 |
Correct |
7 ms |
6608 KB |
Output is correct |
5 |
Correct |
9 ms |
6608 KB |
Output is correct |
6 |
Correct |
8 ms |
6600 KB |
Output is correct |
7 |
Correct |
7 ms |
6608 KB |
Output is correct |
8 |
Correct |
7 ms |
6608 KB |
Output is correct |
9 |
Correct |
7 ms |
6608 KB |
Output is correct |
10 |
Correct |
6 ms |
6608 KB |
Output is correct |
11 |
Correct |
8 ms |
6612 KB |
Output is correct |
12 |
Correct |
0 ms |
208 KB |
Output is correct |
13 |
Correct |
6 ms |
6608 KB |
Output is correct |
14 |
Correct |
7 ms |
6700 KB |
Output is correct |
15 |
Correct |
8 ms |
6608 KB |
Output is correct |
16 |
Correct |
8 ms |
6620 KB |
Output is correct |
17 |
Correct |
7 ms |
6608 KB |
Output is correct |
18 |
Correct |
7 ms |
6608 KB |
Output is correct |
19 |
Correct |
7 ms |
6608 KB |
Output is correct |
20 |
Correct |
7 ms |
6672 KB |
Output is correct |
21 |
Correct |
8 ms |
6608 KB |
Output is correct |
22 |
Correct |
7 ms |
6608 KB |
Output is correct |
23 |
Correct |
7 ms |
6668 KB |
Output is correct |
24 |
Correct |
7 ms |
6716 KB |
Output is correct |
25 |
Correct |
4 ms |
3152 KB |
Output is correct |
26 |
Correct |
7 ms |
6608 KB |
Output is correct |
27 |
Correct |
7 ms |
6608 KB |
Output is correct |
28 |
Correct |
8 ms |
6608 KB |
Output is correct |
29 |
Correct |
8 ms |
6608 KB |
Output is correct |
30 |
Correct |
10 ms |
6608 KB |
Output is correct |
31 |
Correct |
8 ms |
6704 KB |
Output is correct |
32 |
Correct |
7 ms |
6608 KB |
Output is correct |
33 |
Correct |
7 ms |
6632 KB |
Output is correct |
34 |
Correct |
7 ms |
6608 KB |
Output is correct |
35 |
Correct |
7 ms |
6616 KB |
Output is correct |
36 |
Correct |
230 ms |
211036 KB |
Output is correct |
37 |
Correct |
345 ms |
324928 KB |
Output is correct |
38 |
Correct |
354 ms |
324868 KB |
Output is correct |
39 |
Correct |
359 ms |
324884 KB |
Output is correct |
40 |
Correct |
363 ms |
324800 KB |
Output is correct |
41 |
Correct |
431 ms |
324804 KB |
Output is correct |
42 |
Correct |
364 ms |
324756 KB |
Output is correct |
43 |
Correct |
322 ms |
325676 KB |
Output is correct |
44 |
Correct |
322 ms |
325064 KB |
Output is correct |
45 |
Correct |
318 ms |
325348 KB |
Output is correct |
46 |
Correct |
315 ms |
325076 KB |
Output is correct |
47 |
Correct |
349 ms |
324904 KB |
Output is correct |
48 |
Correct |
367 ms |
324712 KB |
Output is correct |
49 |
Correct |
370 ms |
324780 KB |
Output is correct |
50 |
Correct |
336 ms |
325148 KB |
Output is correct |
51 |
Correct |
357 ms |
325464 KB |
Output is correct |
52 |
Correct |
363 ms |
324840 KB |
Output is correct |
53 |
Correct |
368 ms |
324800 KB |
Output is correct |
54 |
Correct |
375 ms |
324708 KB |
Output is correct |
55 |
Correct |
323 ms |
325136 KB |
Output is correct |
56 |
Correct |
326 ms |
325328 KB |
Output is correct |
57 |
Correct |
352 ms |
313784 KB |
Output is correct |
58 |
Correct |
352 ms |
325080 KB |
Output is correct |
59 |
Correct |
351 ms |
324892 KB |
Output is correct |
60 |
Correct |
373 ms |
324700 KB |
Output is correct |
61 |
Correct |
371 ms |
324712 KB |
Output is correct |
62 |
Correct |
397 ms |
324704 KB |
Output is correct |
63 |
Correct |
366 ms |
324696 KB |
Output is correct |
64 |
Correct |
322 ms |
325652 KB |
Output is correct |
65 |
Correct |
318 ms |
325072 KB |
Output is correct |
66 |
Correct |
333 ms |
325184 KB |
Output is correct |
67 |
Correct |
320 ms |
325140 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1341 ms |
322584 KB |
Output is correct |
2 |
Correct |
1641 ms |
324800 KB |
Output is correct |
3 |
Correct |
1598 ms |
324876 KB |
Output is correct |
4 |
Correct |
1552 ms |
324800 KB |
Output is correct |
5 |
Correct |
1553 ms |
324700 KB |
Output is correct |
6 |
Correct |
1383 ms |
324792 KB |
Output is correct |
7 |
Correct |
1641 ms |
324756 KB |
Output is correct |
8 |
Correct |
1479 ms |
325584 KB |
Output is correct |
9 |
Correct |
1532 ms |
325072 KB |
Output is correct |
10 |
Correct |
1545 ms |
325440 KB |
Output is correct |
11 |
Correct |
1569 ms |
325052 KB |
Output is correct |
12 |
Correct |
1484 ms |
325520 KB |
Output is correct |
13 |
Correct |
1587 ms |
325056 KB |
Output is correct |
14 |
Correct |
0 ms |
208 KB |
Output is correct |
15 |
Correct |
7 ms |
6608 KB |
Output is correct |
16 |
Correct |
7 ms |
6608 KB |
Output is correct |
17 |
Correct |
348 ms |
324796 KB |
Output is correct |
18 |
Correct |
377 ms |
324768 KB |
Output is correct |
19 |
Correct |
356 ms |
324812 KB |
Output is correct |
20 |
Correct |
332 ms |
325144 KB |
Output is correct |
21 |
Correct |
327 ms |
325520 KB |
Output is correct |
22 |
Correct |
345 ms |
324892 KB |
Output is correct |
23 |
Correct |
355 ms |
324692 KB |
Output is correct |
24 |
Correct |
359 ms |
324768 KB |
Output is correct |
25 |
Correct |
316 ms |
325136 KB |
Output is correct |
26 |
Correct |
328 ms |
325324 KB |
Output is correct |
27 |
Correct |
7 ms |
6608 KB |
Output is correct |
28 |
Correct |
8 ms |
6608 KB |
Output is correct |
29 |
Correct |
8 ms |
6652 KB |
Output is correct |
30 |
Correct |
7 ms |
6608 KB |
Output is correct |
31 |
Correct |
8 ms |
6608 KB |
Output is correct |
32 |
Correct |
8 ms |
6656 KB |
Output is correct |
33 |
Correct |
9 ms |
6664 KB |
Output is correct |
34 |
Correct |
8 ms |
6608 KB |
Output is correct |
35 |
Correct |
7 ms |
6608 KB |
Output is correct |
36 |
Correct |
7 ms |
6608 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
322 ms |
77452 KB |
Output is correct |
2 |
Correct |
1330 ms |
324800 KB |
Output is correct |
3 |
Correct |
1222 ms |
324980 KB |
Output is correct |
4 |
Correct |
1346 ms |
324760 KB |
Output is correct |
5 |
Correct |
1353 ms |
324876 KB |
Output is correct |
6 |
Correct |
1342 ms |
324796 KB |
Output is correct |
7 |
Correct |
1198 ms |
324808 KB |
Output is correct |
8 |
Correct |
1234 ms |
325524 KB |
Output is correct |
9 |
Correct |
1318 ms |
325184 KB |
Output is correct |
10 |
Correct |
1165 ms |
325236 KB |
Output is correct |
11 |
Correct |
1198 ms |
325084 KB |
Output is correct |
12 |
Correct |
351 ms |
324896 KB |
Output is correct |
13 |
Correct |
364 ms |
324800 KB |
Output is correct |
14 |
Correct |
360 ms |
324716 KB |
Output is correct |
15 |
Correct |
315 ms |
325136 KB |
Output is correct |
16 |
Correct |
325 ms |
325276 KB |
Output is correct |
17 |
Correct |
331 ms |
313764 KB |
Output is correct |
18 |
Correct |
340 ms |
324856 KB |
Output is correct |
19 |
Correct |
349 ms |
324880 KB |
Output is correct |
20 |
Correct |
353 ms |
324792 KB |
Output is correct |
21 |
Correct |
356 ms |
324692 KB |
Output is correct |
22 |
Correct |
359 ms |
324792 KB |
Output is correct |
23 |
Correct |
355 ms |
324800 KB |
Output is correct |
24 |
Correct |
342 ms |
325628 KB |
Output is correct |
25 |
Correct |
311 ms |
325108 KB |
Output is correct |
26 |
Correct |
327 ms |
325244 KB |
Output is correct |
27 |
Correct |
321 ms |
325288 KB |
Output is correct |
28 |
Correct |
9 ms |
6608 KB |
Output is correct |
29 |
Correct |
7 ms |
6608 KB |
Output is correct |
30 |
Correct |
7 ms |
6608 KB |
Output is correct |
31 |
Correct |
7 ms |
6608 KB |
Output is correct |
32 |
Correct |
7 ms |
6608 KB |
Output is correct |
33 |
Correct |
3 ms |
3152 KB |
Output is correct |
34 |
Correct |
7 ms |
6608 KB |
Output is correct |
35 |
Correct |
8 ms |
6700 KB |
Output is correct |
36 |
Correct |
8 ms |
6692 KB |
Output is correct |
37 |
Correct |
7 ms |
6652 KB |
Output is correct |
38 |
Correct |
8 ms |
6680 KB |
Output is correct |
39 |
Correct |
7 ms |
6592 KB |
Output is correct |
40 |
Correct |
7 ms |
6608 KB |
Output is correct |
41 |
Correct |
7 ms |
6708 KB |
Output is correct |
42 |
Correct |
7 ms |
6608 KB |
Output is correct |
43 |
Correct |
7 ms |
6592 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
1616 KB |
Output is correct |
2 |
Correct |
7 ms |
6608 KB |
Output is correct |
3 |
Correct |
7 ms |
6700 KB |
Output is correct |
4 |
Correct |
7 ms |
6608 KB |
Output is correct |
5 |
Correct |
9 ms |
6608 KB |
Output is correct |
6 |
Correct |
8 ms |
6600 KB |
Output is correct |
7 |
Correct |
7 ms |
6608 KB |
Output is correct |
8 |
Correct |
7 ms |
6608 KB |
Output is correct |
9 |
Correct |
7 ms |
6608 KB |
Output is correct |
10 |
Correct |
6 ms |
6608 KB |
Output is correct |
11 |
Correct |
8 ms |
6612 KB |
Output is correct |
12 |
Correct |
0 ms |
208 KB |
Output is correct |
13 |
Correct |
6 ms |
6608 KB |
Output is correct |
14 |
Correct |
7 ms |
6700 KB |
Output is correct |
15 |
Correct |
8 ms |
6608 KB |
Output is correct |
16 |
Correct |
8 ms |
6620 KB |
Output is correct |
17 |
Correct |
7 ms |
6608 KB |
Output is correct |
18 |
Correct |
7 ms |
6608 KB |
Output is correct |
19 |
Correct |
7 ms |
6608 KB |
Output is correct |
20 |
Correct |
7 ms |
6672 KB |
Output is correct |
21 |
Correct |
8 ms |
6608 KB |
Output is correct |
22 |
Correct |
7 ms |
6608 KB |
Output is correct |
23 |
Correct |
7 ms |
6668 KB |
Output is correct |
24 |
Correct |
7 ms |
6716 KB |
Output is correct |
25 |
Correct |
4 ms |
3152 KB |
Output is correct |
26 |
Correct |
7 ms |
6608 KB |
Output is correct |
27 |
Correct |
7 ms |
6608 KB |
Output is correct |
28 |
Correct |
8 ms |
6608 KB |
Output is correct |
29 |
Correct |
8 ms |
6608 KB |
Output is correct |
30 |
Correct |
10 ms |
6608 KB |
Output is correct |
31 |
Correct |
8 ms |
6704 KB |
Output is correct |
32 |
Correct |
7 ms |
6608 KB |
Output is correct |
33 |
Correct |
7 ms |
6632 KB |
Output is correct |
34 |
Correct |
7 ms |
6608 KB |
Output is correct |
35 |
Correct |
7 ms |
6616 KB |
Output is correct |
36 |
Correct |
230 ms |
211036 KB |
Output is correct |
37 |
Correct |
345 ms |
324928 KB |
Output is correct |
38 |
Correct |
354 ms |
324868 KB |
Output is correct |
39 |
Correct |
359 ms |
324884 KB |
Output is correct |
40 |
Correct |
363 ms |
324800 KB |
Output is correct |
41 |
Correct |
431 ms |
324804 KB |
Output is correct |
42 |
Correct |
364 ms |
324756 KB |
Output is correct |
43 |
Correct |
322 ms |
325676 KB |
Output is correct |
44 |
Correct |
322 ms |
325064 KB |
Output is correct |
45 |
Correct |
318 ms |
325348 KB |
Output is correct |
46 |
Correct |
315 ms |
325076 KB |
Output is correct |
47 |
Correct |
349 ms |
324904 KB |
Output is correct |
48 |
Correct |
367 ms |
324712 KB |
Output is correct |
49 |
Correct |
370 ms |
324780 KB |
Output is correct |
50 |
Correct |
336 ms |
325148 KB |
Output is correct |
51 |
Correct |
357 ms |
325464 KB |
Output is correct |
52 |
Correct |
363 ms |
324840 KB |
Output is correct |
53 |
Correct |
368 ms |
324800 KB |
Output is correct |
54 |
Correct |
375 ms |
324708 KB |
Output is correct |
55 |
Correct |
323 ms |
325136 KB |
Output is correct |
56 |
Correct |
326 ms |
325328 KB |
Output is correct |
57 |
Correct |
352 ms |
313784 KB |
Output is correct |
58 |
Correct |
352 ms |
325080 KB |
Output is correct |
59 |
Correct |
351 ms |
324892 KB |
Output is correct |
60 |
Correct |
373 ms |
324700 KB |
Output is correct |
61 |
Correct |
371 ms |
324712 KB |
Output is correct |
62 |
Correct |
397 ms |
324704 KB |
Output is correct |
63 |
Correct |
366 ms |
324696 KB |
Output is correct |
64 |
Correct |
322 ms |
325652 KB |
Output is correct |
65 |
Correct |
318 ms |
325072 KB |
Output is correct |
66 |
Correct |
333 ms |
325184 KB |
Output is correct |
67 |
Correct |
320 ms |
325140 KB |
Output is correct |
68 |
Correct |
1341 ms |
322584 KB |
Output is correct |
69 |
Correct |
1641 ms |
324800 KB |
Output is correct |
70 |
Correct |
1598 ms |
324876 KB |
Output is correct |
71 |
Correct |
1552 ms |
324800 KB |
Output is correct |
72 |
Correct |
1553 ms |
324700 KB |
Output is correct |
73 |
Correct |
1383 ms |
324792 KB |
Output is correct |
74 |
Correct |
1641 ms |
324756 KB |
Output is correct |
75 |
Correct |
1479 ms |
325584 KB |
Output is correct |
76 |
Correct |
1532 ms |
325072 KB |
Output is correct |
77 |
Correct |
1545 ms |
325440 KB |
Output is correct |
78 |
Correct |
1569 ms |
325052 KB |
Output is correct |
79 |
Correct |
1484 ms |
325520 KB |
Output is correct |
80 |
Correct |
1587 ms |
325056 KB |
Output is correct |
81 |
Correct |
0 ms |
208 KB |
Output is correct |
82 |
Correct |
7 ms |
6608 KB |
Output is correct |
83 |
Correct |
7 ms |
6608 KB |
Output is correct |
84 |
Correct |
348 ms |
324796 KB |
Output is correct |
85 |
Correct |
377 ms |
324768 KB |
Output is correct |
86 |
Correct |
356 ms |
324812 KB |
Output is correct |
87 |
Correct |
332 ms |
325144 KB |
Output is correct |
88 |
Correct |
327 ms |
325520 KB |
Output is correct |
89 |
Correct |
345 ms |
324892 KB |
Output is correct |
90 |
Correct |
355 ms |
324692 KB |
Output is correct |
91 |
Correct |
359 ms |
324768 KB |
Output is correct |
92 |
Correct |
316 ms |
325136 KB |
Output is correct |
93 |
Correct |
328 ms |
325324 KB |
Output is correct |
94 |
Correct |
7 ms |
6608 KB |
Output is correct |
95 |
Correct |
8 ms |
6608 KB |
Output is correct |
96 |
Correct |
8 ms |
6652 KB |
Output is correct |
97 |
Correct |
7 ms |
6608 KB |
Output is correct |
98 |
Correct |
8 ms |
6608 KB |
Output is correct |
99 |
Correct |
8 ms |
6656 KB |
Output is correct |
100 |
Correct |
9 ms |
6664 KB |
Output is correct |
101 |
Correct |
8 ms |
6608 KB |
Output is correct |
102 |
Correct |
7 ms |
6608 KB |
Output is correct |
103 |
Correct |
7 ms |
6608 KB |
Output is correct |
104 |
Correct |
1153 ms |
288336 KB |
Output is correct |
105 |
Correct |
1373 ms |
324952 KB |
Output is correct |
106 |
Correct |
1466 ms |
324828 KB |
Output is correct |
107 |
Correct |
1424 ms |
324760 KB |
Output is correct |
108 |
Correct |
1565 ms |
324780 KB |
Output is correct |
109 |
Correct |
1564 ms |
324736 KB |
Output is correct |
110 |
Correct |
1243 ms |
324804 KB |
Output is correct |
111 |
Correct |
1336 ms |
325568 KB |
Output is correct |
112 |
Correct |
1324 ms |
325188 KB |
Output is correct |
113 |
Correct |
1358 ms |
325148 KB |
Output is correct |
114 |
Correct |
1242 ms |
325088 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
602 ms |
193744 KB |
Output is correct |
2 |
Correct |
1375 ms |
325444 KB |
Output is correct |
3 |
Correct |
1299 ms |
325528 KB |
Output is correct |
4 |
Correct |
1437 ms |
325600 KB |
Output is correct |
5 |
Correct |
1362 ms |
325068 KB |
Output is correct |
6 |
Correct |
1528 ms |
325544 KB |
Output is correct |
7 |
Correct |
1486 ms |
325104 KB |
Output is correct |
8 |
Correct |
0 ms |
208 KB |
Output is correct |
9 |
Correct |
7 ms |
6600 KB |
Output is correct |
10 |
Correct |
7 ms |
6576 KB |
Output is correct |
11 |
Correct |
2 ms |
1616 KB |
Output is correct |
12 |
Correct |
7 ms |
6608 KB |
Output is correct |
13 |
Correct |
7 ms |
6700 KB |
Output is correct |
14 |
Correct |
7 ms |
6608 KB |
Output is correct |
15 |
Correct |
9 ms |
6608 KB |
Output is correct |
16 |
Correct |
8 ms |
6600 KB |
Output is correct |
17 |
Correct |
7 ms |
6608 KB |
Output is correct |
18 |
Correct |
7 ms |
6608 KB |
Output is correct |
19 |
Correct |
7 ms |
6608 KB |
Output is correct |
20 |
Correct |
6 ms |
6608 KB |
Output is correct |
21 |
Correct |
8 ms |
6612 KB |
Output is correct |
22 |
Correct |
0 ms |
208 KB |
Output is correct |
23 |
Correct |
6 ms |
6608 KB |
Output is correct |
24 |
Correct |
7 ms |
6700 KB |
Output is correct |
25 |
Correct |
8 ms |
6608 KB |
Output is correct |
26 |
Correct |
8 ms |
6620 KB |
Output is correct |
27 |
Correct |
7 ms |
6608 KB |
Output is correct |
28 |
Correct |
7 ms |
6608 KB |
Output is correct |
29 |
Correct |
7 ms |
6608 KB |
Output is correct |
30 |
Correct |
7 ms |
6672 KB |
Output is correct |
31 |
Correct |
8 ms |
6608 KB |
Output is correct |
32 |
Correct |
7 ms |
6608 KB |
Output is correct |
33 |
Correct |
7 ms |
6668 KB |
Output is correct |
34 |
Correct |
7 ms |
6716 KB |
Output is correct |
35 |
Correct |
4 ms |
3152 KB |
Output is correct |
36 |
Correct |
7 ms |
6608 KB |
Output is correct |
37 |
Correct |
7 ms |
6608 KB |
Output is correct |
38 |
Correct |
8 ms |
6608 KB |
Output is correct |
39 |
Correct |
8 ms |
6608 KB |
Output is correct |
40 |
Correct |
10 ms |
6608 KB |
Output is correct |
41 |
Correct |
8 ms |
6704 KB |
Output is correct |
42 |
Correct |
7 ms |
6608 KB |
Output is correct |
43 |
Correct |
7 ms |
6632 KB |
Output is correct |
44 |
Correct |
7 ms |
6608 KB |
Output is correct |
45 |
Correct |
7 ms |
6616 KB |
Output is correct |
46 |
Correct |
230 ms |
211036 KB |
Output is correct |
47 |
Correct |
345 ms |
324928 KB |
Output is correct |
48 |
Correct |
354 ms |
324868 KB |
Output is correct |
49 |
Correct |
359 ms |
324884 KB |
Output is correct |
50 |
Correct |
363 ms |
324800 KB |
Output is correct |
51 |
Correct |
431 ms |
324804 KB |
Output is correct |
52 |
Correct |
364 ms |
324756 KB |
Output is correct |
53 |
Correct |
322 ms |
325676 KB |
Output is correct |
54 |
Correct |
322 ms |
325064 KB |
Output is correct |
55 |
Correct |
318 ms |
325348 KB |
Output is correct |
56 |
Correct |
315 ms |
325076 KB |
Output is correct |
57 |
Correct |
349 ms |
324904 KB |
Output is correct |
58 |
Correct |
367 ms |
324712 KB |
Output is correct |
59 |
Correct |
370 ms |
324780 KB |
Output is correct |
60 |
Correct |
336 ms |
325148 KB |
Output is correct |
61 |
Correct |
357 ms |
325464 KB |
Output is correct |
62 |
Correct |
363 ms |
324840 KB |
Output is correct |
63 |
Correct |
368 ms |
324800 KB |
Output is correct |
64 |
Correct |
375 ms |
324708 KB |
Output is correct |
65 |
Correct |
323 ms |
325136 KB |
Output is correct |
66 |
Correct |
326 ms |
325328 KB |
Output is correct |
67 |
Correct |
352 ms |
313784 KB |
Output is correct |
68 |
Correct |
352 ms |
325080 KB |
Output is correct |
69 |
Correct |
351 ms |
324892 KB |
Output is correct |
70 |
Correct |
373 ms |
324700 KB |
Output is correct |
71 |
Correct |
371 ms |
324712 KB |
Output is correct |
72 |
Correct |
397 ms |
324704 KB |
Output is correct |
73 |
Correct |
366 ms |
324696 KB |
Output is correct |
74 |
Correct |
322 ms |
325652 KB |
Output is correct |
75 |
Correct |
318 ms |
325072 KB |
Output is correct |
76 |
Correct |
333 ms |
325184 KB |
Output is correct |
77 |
Correct |
320 ms |
325140 KB |
Output is correct |
78 |
Correct |
1341 ms |
322584 KB |
Output is correct |
79 |
Correct |
1641 ms |
324800 KB |
Output is correct |
80 |
Correct |
1598 ms |
324876 KB |
Output is correct |
81 |
Correct |
1552 ms |
324800 KB |
Output is correct |
82 |
Correct |
1553 ms |
324700 KB |
Output is correct |
83 |
Correct |
1383 ms |
324792 KB |
Output is correct |
84 |
Correct |
1641 ms |
324756 KB |
Output is correct |
85 |
Correct |
1479 ms |
325584 KB |
Output is correct |
86 |
Correct |
1532 ms |
325072 KB |
Output is correct |
87 |
Correct |
1545 ms |
325440 KB |
Output is correct |
88 |
Correct |
1569 ms |
325052 KB |
Output is correct |
89 |
Correct |
1484 ms |
325520 KB |
Output is correct |
90 |
Correct |
1587 ms |
325056 KB |
Output is correct |
91 |
Correct |
0 ms |
208 KB |
Output is correct |
92 |
Correct |
7 ms |
6608 KB |
Output is correct |
93 |
Correct |
7 ms |
6608 KB |
Output is correct |
94 |
Correct |
348 ms |
324796 KB |
Output is correct |
95 |
Correct |
377 ms |
324768 KB |
Output is correct |
96 |
Correct |
356 ms |
324812 KB |
Output is correct |
97 |
Correct |
332 ms |
325144 KB |
Output is correct |
98 |
Correct |
327 ms |
325520 KB |
Output is correct |
99 |
Correct |
345 ms |
324892 KB |
Output is correct |
100 |
Correct |
355 ms |
324692 KB |
Output is correct |
101 |
Correct |
359 ms |
324768 KB |
Output is correct |
102 |
Correct |
316 ms |
325136 KB |
Output is correct |
103 |
Correct |
328 ms |
325324 KB |
Output is correct |
104 |
Correct |
7 ms |
6608 KB |
Output is correct |
105 |
Correct |
8 ms |
6608 KB |
Output is correct |
106 |
Correct |
8 ms |
6652 KB |
Output is correct |
107 |
Correct |
7 ms |
6608 KB |
Output is correct |
108 |
Correct |
8 ms |
6608 KB |
Output is correct |
109 |
Correct |
8 ms |
6656 KB |
Output is correct |
110 |
Correct |
9 ms |
6664 KB |
Output is correct |
111 |
Correct |
8 ms |
6608 KB |
Output is correct |
112 |
Correct |
7 ms |
6608 KB |
Output is correct |
113 |
Correct |
7 ms |
6608 KB |
Output is correct |
114 |
Correct |
322 ms |
77452 KB |
Output is correct |
115 |
Correct |
1330 ms |
324800 KB |
Output is correct |
116 |
Correct |
1222 ms |
324980 KB |
Output is correct |
117 |
Correct |
1346 ms |
324760 KB |
Output is correct |
118 |
Correct |
1353 ms |
324876 KB |
Output is correct |
119 |
Correct |
1342 ms |
324796 KB |
Output is correct |
120 |
Correct |
1198 ms |
324808 KB |
Output is correct |
121 |
Correct |
1234 ms |
325524 KB |
Output is correct |
122 |
Correct |
1318 ms |
325184 KB |
Output is correct |
123 |
Correct |
1165 ms |
325236 KB |
Output is correct |
124 |
Correct |
1198 ms |
325084 KB |
Output is correct |
125 |
Correct |
351 ms |
324896 KB |
Output is correct |
126 |
Correct |
364 ms |
324800 KB |
Output is correct |
127 |
Correct |
360 ms |
324716 KB |
Output is correct |
128 |
Correct |
315 ms |
325136 KB |
Output is correct |
129 |
Correct |
325 ms |
325276 KB |
Output is correct |
130 |
Correct |
331 ms |
313764 KB |
Output is correct |
131 |
Correct |
340 ms |
324856 KB |
Output is correct |
132 |
Correct |
349 ms |
324880 KB |
Output is correct |
133 |
Correct |
353 ms |
324792 KB |
Output is correct |
134 |
Correct |
356 ms |
324692 KB |
Output is correct |
135 |
Correct |
359 ms |
324792 KB |
Output is correct |
136 |
Correct |
355 ms |
324800 KB |
Output is correct |
137 |
Correct |
342 ms |
325628 KB |
Output is correct |
138 |
Correct |
311 ms |
325108 KB |
Output is correct |
139 |
Correct |
327 ms |
325244 KB |
Output is correct |
140 |
Correct |
321 ms |
325288 KB |
Output is correct |
141 |
Correct |
9 ms |
6608 KB |
Output is correct |
142 |
Correct |
7 ms |
6608 KB |
Output is correct |
143 |
Correct |
7 ms |
6608 KB |
Output is correct |
144 |
Correct |
7 ms |
6608 KB |
Output is correct |
145 |
Correct |
7 ms |
6608 KB |
Output is correct |
146 |
Correct |
3 ms |
3152 KB |
Output is correct |
147 |
Correct |
7 ms |
6608 KB |
Output is correct |
148 |
Correct |
8 ms |
6700 KB |
Output is correct |
149 |
Correct |
8 ms |
6692 KB |
Output is correct |
150 |
Correct |
7 ms |
6652 KB |
Output is correct |
151 |
Correct |
8 ms |
6680 KB |
Output is correct |
152 |
Correct |
7 ms |
6592 KB |
Output is correct |
153 |
Correct |
7 ms |
6608 KB |
Output is correct |
154 |
Correct |
7 ms |
6708 KB |
Output is correct |
155 |
Correct |
7 ms |
6608 KB |
Output is correct |
156 |
Correct |
7 ms |
6592 KB |
Output is correct |
157 |
Correct |
1153 ms |
288336 KB |
Output is correct |
158 |
Correct |
1373 ms |
324952 KB |
Output is correct |
159 |
Correct |
1466 ms |
324828 KB |
Output is correct |
160 |
Correct |
1424 ms |
324760 KB |
Output is correct |
161 |
Correct |
1565 ms |
324780 KB |
Output is correct |
162 |
Correct |
1564 ms |
324736 KB |
Output is correct |
163 |
Correct |
1243 ms |
324804 KB |
Output is correct |
164 |
Correct |
1336 ms |
325568 KB |
Output is correct |
165 |
Correct |
1324 ms |
325188 KB |
Output is correct |
166 |
Correct |
1358 ms |
325148 KB |
Output is correct |
167 |
Correct |
1242 ms |
325088 KB |
Output is correct |
168 |
Correct |
0 ms |
208 KB |
Output is correct |
169 |
Correct |
927 ms |
112616 KB |
Output is correct |
170 |
Correct |
1557 ms |
324868 KB |
Output is correct |
171 |
Correct |
1651 ms |
324892 KB |
Output is correct |
172 |
Correct |
1725 ms |
324756 KB |
Output is correct |
173 |
Correct |
1669 ms |
324716 KB |
Output is correct |
174 |
Correct |
1618 ms |
324764 KB |
Output is correct |
175 |
Correct |
1571 ms |
324724 KB |
Output is correct |
176 |
Correct |
1306 ms |
325480 KB |
Output is correct |
177 |
Correct |
1333 ms |
325160 KB |
Output is correct |
178 |
Correct |
1320 ms |
325136 KB |
Output is correct |
179 |
Correct |
1413 ms |
325136 KB |
Output is correct |