#include "towers.h"
#include "bits/stdc++.h"
using namespace std;
//~ #ifndef EVAL
//~ #include "stub.cpp"
//~ #endif
#define ar array
typedef int64_t ll;
//~ #define int ll
const int inf = 1e9 + 7;
const int N = 1e5 + 5;
const int B = 320;
//~ int first, mount;
//~ vector<int> a, l, r, res;
vector<ar<int, 2>> res;
vector<int> a, tot;
struct STMx{
vector<int> tree;
int N;
STMx(int N): N(N){
tree.resize(N << 2);
}
void set(int i, int v, int lx, int rx, int x){
if(lx == rx){
tree[x] = v;
return;
}
int m = (lx + rx) >> 1;
if(i <= m) set(i, v, lx, m, x << 1);
else set(i, v, m + 1, rx, x << 1 | 1);
tree[x] = max(tree[x << 1], tree[x << 1 | 1]);
}
void set(int i, int v){
set(i, v, 0, N, 1);
}
int get(int l, int r, int lx, int rx, int x){
if(lx > r || rx < l){
return 0;
}
if(lx >= l && rx <= r){
return tree[x];
}
int m = (lx + rx) >> 1;
return max(get(l, r, lx, m, x << 1), get(l, r, m + 1, rx, x << 1 | 1));
}
int get(int l, int r){
return get(l, r, 0, N, 1);
}
int first(int l, int r, int v, int lx, int rx, int x){
if(lx > r || rx < l) return -1;
if(lx >= l && rx <= r){
if(tree[x] < v) return -1;
if(lx == rx) return lx;
int m = (lx + rx) >> 1;
if(tree[x << 1] >= v) return first(l, r, v, lx, m, x << 1);
else return first(l, r, v, m + 1, rx, x << 1 | 1);
}
int m = (lx + rx) >> 1;
int res = first(l, r, v, lx, m, x << 1);
if(res == -1) res = first(l, r, v, m + 1, rx, x << 1 | 1);
return res;
}
int first(int l, int r, int v){
return first(l, r, v, 0, N, 1);
}
int last(int l, int r, int v, int lx, int rx, int x){
if(lx > r || rx < l) return -1;
if(lx >= l && rx <= r){
if(tree[x] < v) return -1;
if(lx == rx) return lx;
int m = (lx + rx) >> 1;
if(tree[x << 1 | 1] >= v) return last(l, r, v, m + 1, rx, x << 1 | 1);
else return last(l, r, v, lx, m, x << 1);
}
int m = (lx + rx) >> 1;
int res = last(l, r, v, m + 1, rx, x << 1 | 1);
if(res == -1) res = last(l, r, v, lx, m, x << 1);
return res;
}
int last(int l, int r, int v){
return last(l, r, v, 0, N, 1);
}
}Max(N);
struct ST{
vector<int> Max, Min, t01, t10;
int N;
ST(int N): N(N){
Max.resize(N << 2);
Min.resize(N << 2);
t01.resize(N << 2);
t10.resize(N << 2);
}
void set(int i, int v, int lx, int rx, int x){
if(lx == rx){
t01[x] = t10[x] = 0;
Max[x] = Min[x] = v;
return;
}
int m = (lx + rx) >> 1;
if(i <= m) set(i, v, lx, m, x << 1);
else set(i, v, m + 1, rx, x << 1 | 1);
t01[x] = max({t01[x << 1], t01[x << 1 | 1], Max[x << 1 | 1] - Min[x << 1]});
t10[x] = max({t10[x << 1], t10[x << 1 | 1], Max[x << 1] - Min[x << 1 | 1]});
Max[x] = max(Max[x << 1], Max[x << 1 | 1]);
Min[x] = min(Min[x << 1], Min[x << 1 | 1]);
}
void set(int i, int v){
set(i, v, 0, N, 1);
}
int mn, mx;
int get01(int l, int r, int d, int lx, int rx, int x){
if(lx > r || rx < l){
return -1;
}
if(lx >= l && rx <= r){
if(t01[x] < d && Max[x] - mn < d){
mn = min(mn, Min[x]);
return -1;
}
if(lx == rx) return lx;
int m = (lx + rx) >> 1;
if(Max[x << 1] - mn >= d || t01[x << 1] >= d){
return get01(l, r, d, lx, m, x << 1);
} else {
mn = min(mn, Min[x << 1]);
return get01(l, r, d, m + 1, rx, x << 1 | 1);
}
}
int m = (lx + rx) >> 1;
int res = get01(l, r, d, lx, m, x << 1);
if(res == -1) res = get01(l, r, d, m + 1, rx, x << 1 | 1);
return res;
}
int get01(int l, int r, int d){
mn = inf;
return get01(l, r, d, 0, N, 1);
}
int get10(int l, int r, int d, int lx, int rx, int x){
if(lx > r || rx < l){
return -1;
}
if(lx >= l && rx <= r){
if(t10[x] < d && Max[x] - mn < d){
mn = min(mn, Min[x]);
return -1;
}
if(lx == rx) return lx;
int m = (lx + rx) >> 1;
if(Max[x << 1 | 1] - mn >= d || t10[x << 1 | 1] >= d){
return get10(l, r, d, m + 1, rx, x << 1 | 1);
} else {
mn = min(mn, Min[x << 1 | 1]);
return get10(l, r, d, lx, m, x << 1);
}
}
int m = (lx + rx) >> 1;
int res = get10(l, r, d, m + 1, rx, x << 1 | 1);
if(res == -1) res = get10(l, r, d, lx, m, x << 1);
return res;
}
int get10(int l, int r, int d){
mn = inf;
return get10(l, r, d, 0, N, 1);
}
}tree(N);
vector<int> v;
void init(int n, vector<int> h) {
a = h;
vector<int> pos;
for(int i=0;i<n;i++){
Max.set(i, a[i]);
if((!i || a[i] < a[i - 1]) && (i + 1 == n || a[i] < a[i + 1])){
pos.push_back(i);
}
}
set<int> ss;
multiset<ar<int, 2>> dif;
for(int i=0;i<(int)pos.size();i++){
if(i){
int mx = Max.get(pos[i - 1], pos[i]);
dif.insert({mx - a[pos[i - 1]], pos[i - 1]});
dif.insert({mx - a[pos[i]], pos[i]});
}
ss.insert(pos[i]);
}
while(!dif.empty()){
auto [d, i] = *dif.begin();
res.push_back({d, i});
//~ cout<<i<<" "<<d<<"\n";
auto it = ss.lower_bound(i);
auto R = it; R++;
if(it == ss.begin() || R == ss.end()){
if(it == ss.begin()){
int mx = Max.get(*it, *R);
dif.erase(dif.find({mx - a[*it], *it}));
dif.erase(dif.find({mx - a[*R], *R}));
} else {
auto L = it; L--;
int mx = Max.get(*L, *it);
dif.erase(dif.find({mx - a[*it], *it}));
dif.erase(dif.find({mx - a[*L], *L}));
}
ss.erase(it);
continue;
}
auto L = it; --L;
int mx = Max.get(*L, *it);
dif.erase(dif.find({mx - a[*it], *it}));
dif.erase(dif.find({mx - a[*L], *L}));
mx = Max.get(*it, *R);
dif.erase(dif.find({mx - a[*it], *it}));
dif.erase(dif.find({mx - a[*R], *R}));
mx = Max.get(*L, *R);
dif.insert({mx - a[*L], *L});
dif.insert({mx - a[*R], *R});
ss.erase(it);
}
res.push_back({inf, *ss.begin()});
for(auto x : res) tot.push_back(x[0]);
tot.erase(unique(tot.begin(), tot.end()), tot.end());
v.resize(n);
for(auto [d, i] : res){
v[i] = lower_bound(tot.begin(), tot.end(), d) - tot.begin() + 1;
}
for(int i=0;i<n;i++){
tree.set(i, a[i]);
assert(v[i] <= N);
//~ block.set(i, v[i]);
}
//~ block.build();
}
int max_towers(int l, int r, int d) {
int D = lower_bound(tot.begin(), tot.end(), d) - tot.begin() + 1;
int n = a.size();
//~ int j = lower_bound(res.begin(), res.end(), (ar<int, 2>){d, 0}) - res.begin();
//~ return (int)res.size() - j;
//~ int res = block.get(l, r, D);
auto get = [&](int l, int r, int d){
int res = 0;
for(int i=l;i<=r;i++){
if(v[i] >= d) res++;
}
return res;
};
int res = get(l, r, D);
auto get01 = [&](int l, int r, int d){
int mn = inf;
for(int i=l;i<=r;i++){
if(a[i] >= mn + d){
return i;
}
mn = min(mn, a[i]);
}
return -1;
};
auto get10 = [&](int l, int r, int d){
int mn = inf;
for(int i=r;i>=l;i--){
if(a[i] >= mn + d){
return i;
}
mn = min(mn, a[i]);
}
return -1;
};
if(!res){
int l_ = tree.get01(l, r, d), r_ = tree.get10(l, r, d);
//~ int l_ = get01(l, r, d), r_ = get10(l, r, d);
if(~l_ && ~r_ && l_ <= r_){
return 2;
}
return 1;
}
auto first = [&](int l, int r, int d){
for(int i=l;i<=r;i++){
if(v[i] >= d) return i;
}
assert(false);
return -1;
};
auto last = [&](int l, int r, int d){
for(int i=r;i>=l;i--){
if(v[i] >= d) return i;
}
assert(false);
return -1;
};
//~ int l_ = block.first(l, r, D), r_ = block.last(l, r, D);
int l_ = first(l, r, D), r_ = last(l, r, D);
l_ = Max.last(l, l_, a[l_] + d);
r_ = Max.first(r_, r, a[r_] + d);
if(~l_ && ~tree.get01(l, l_, d)){
res++;
}
if(~r_ && ~tree.get10(r_, r, d)){
res++;
}
//~ if(~l_ && ~get01(l, l_, d)){
//~ res++;
//~ }
//~ if(~r_ && ~get10(r_, r, d)){
//~ res++;
//~ }
return res;
}
Compilation message
towers.cpp: In function 'int max_towers(int, int, int)':
towers.cpp:280:10: warning: unused variable 'n' [-Wunused-variable]
280 | int n = a.size();
| ^
towers.cpp:296:11: warning: variable 'get01' set but not used [-Wunused-but-set-variable]
296 | auto get01 = [&](int l, int r, int d){
| ^~~~~
towers.cpp:307:11: warning: variable 'get10' set but not used [-Wunused-but-set-variable]
307 | auto get10 = [&](int l, int r, int d){
| ^~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
993 ms |
9048 KB |
Output is correct |
2 |
Correct |
3044 ms |
9816 KB |
Output is correct |
3 |
Correct |
3023 ms |
9816 KB |
Output is correct |
4 |
Correct |
3087 ms |
9816 KB |
Output is correct |
5 |
Correct |
3036 ms |
9816 KB |
Output is correct |
6 |
Correct |
3005 ms |
9816 KB |
Output is correct |
7 |
Correct |
2982 ms |
9816 KB |
Output is correct |
8 |
Correct |
3 ms |
8280 KB |
Output is correct |
9 |
Correct |
4 ms |
8280 KB |
Output is correct |
10 |
Correct |
3 ms |
8280 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
8280 KB |
Output is correct |
2 |
Correct |
5 ms |
8280 KB |
Output is correct |
3 |
Correct |
4 ms |
8280 KB |
Output is correct |
4 |
Correct |
5 ms |
8280 KB |
Output is correct |
5 |
Correct |
5 ms |
8280 KB |
Output is correct |
6 |
Correct |
5 ms |
8280 KB |
Output is correct |
7 |
Correct |
5 ms |
8280 KB |
Output is correct |
8 |
Correct |
4 ms |
8280 KB |
Output is correct |
9 |
Correct |
3 ms |
8304 KB |
Output is correct |
10 |
Correct |
4 ms |
8280 KB |
Output is correct |
11 |
Correct |
3 ms |
8280 KB |
Output is correct |
12 |
Correct |
3 ms |
8024 KB |
Output is correct |
13 |
Correct |
4 ms |
8280 KB |
Output is correct |
14 |
Correct |
6 ms |
8280 KB |
Output is correct |
15 |
Correct |
5 ms |
8280 KB |
Output is correct |
16 |
Correct |
6 ms |
8280 KB |
Output is correct |
17 |
Correct |
5 ms |
8280 KB |
Output is correct |
18 |
Correct |
3 ms |
8280 KB |
Output is correct |
19 |
Correct |
4 ms |
8532 KB |
Output is correct |
20 |
Correct |
6 ms |
8280 KB |
Output is correct |
21 |
Correct |
5 ms |
8280 KB |
Output is correct |
22 |
Correct |
5 ms |
8280 KB |
Output is correct |
23 |
Correct |
4 ms |
8280 KB |
Output is correct |
24 |
Correct |
4 ms |
8280 KB |
Output is correct |
25 |
Correct |
4 ms |
8280 KB |
Output is correct |
26 |
Correct |
5 ms |
8280 KB |
Output is correct |
27 |
Correct |
4 ms |
8280 KB |
Output is correct |
28 |
Correct |
5 ms |
8280 KB |
Output is correct |
29 |
Correct |
5 ms |
8280 KB |
Output is correct |
30 |
Correct |
7 ms |
8280 KB |
Output is correct |
31 |
Correct |
5 ms |
8280 KB |
Output is correct |
32 |
Correct |
4 ms |
8132 KB |
Output is correct |
33 |
Correct |
4 ms |
8280 KB |
Output is correct |
34 |
Correct |
3 ms |
8280 KB |
Output is correct |
35 |
Correct |
4 ms |
8280 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
8280 KB |
Output is correct |
2 |
Correct |
5 ms |
8280 KB |
Output is correct |
3 |
Correct |
4 ms |
8280 KB |
Output is correct |
4 |
Correct |
5 ms |
8280 KB |
Output is correct |
5 |
Correct |
5 ms |
8280 KB |
Output is correct |
6 |
Correct |
5 ms |
8280 KB |
Output is correct |
7 |
Correct |
5 ms |
8280 KB |
Output is correct |
8 |
Correct |
4 ms |
8280 KB |
Output is correct |
9 |
Correct |
3 ms |
8304 KB |
Output is correct |
10 |
Correct |
4 ms |
8280 KB |
Output is correct |
11 |
Correct |
3 ms |
8280 KB |
Output is correct |
12 |
Correct |
3 ms |
8024 KB |
Output is correct |
13 |
Correct |
4 ms |
8280 KB |
Output is correct |
14 |
Correct |
6 ms |
8280 KB |
Output is correct |
15 |
Correct |
5 ms |
8280 KB |
Output is correct |
16 |
Correct |
6 ms |
8280 KB |
Output is correct |
17 |
Correct |
5 ms |
8280 KB |
Output is correct |
18 |
Correct |
3 ms |
8280 KB |
Output is correct |
19 |
Correct |
4 ms |
8532 KB |
Output is correct |
20 |
Correct |
6 ms |
8280 KB |
Output is correct |
21 |
Correct |
5 ms |
8280 KB |
Output is correct |
22 |
Correct |
5 ms |
8280 KB |
Output is correct |
23 |
Correct |
4 ms |
8280 KB |
Output is correct |
24 |
Correct |
4 ms |
8280 KB |
Output is correct |
25 |
Correct |
4 ms |
8280 KB |
Output is correct |
26 |
Correct |
5 ms |
8280 KB |
Output is correct |
27 |
Correct |
4 ms |
8280 KB |
Output is correct |
28 |
Correct |
5 ms |
8280 KB |
Output is correct |
29 |
Correct |
5 ms |
8280 KB |
Output is correct |
30 |
Correct |
7 ms |
8280 KB |
Output is correct |
31 |
Correct |
5 ms |
8280 KB |
Output is correct |
32 |
Correct |
4 ms |
8132 KB |
Output is correct |
33 |
Correct |
4 ms |
8280 KB |
Output is correct |
34 |
Correct |
3 ms |
8280 KB |
Output is correct |
35 |
Correct |
4 ms |
8280 KB |
Output is correct |
36 |
Correct |
73 ms |
12376 KB |
Output is correct |
37 |
Correct |
118 ms |
14684 KB |
Output is correct |
38 |
Correct |
119 ms |
14800 KB |
Output is correct |
39 |
Correct |
172 ms |
17356 KB |
Output is correct |
40 |
Correct |
169 ms |
17352 KB |
Output is correct |
41 |
Correct |
183 ms |
17356 KB |
Output is correct |
42 |
Correct |
172 ms |
17388 KB |
Output is correct |
43 |
Correct |
32 ms |
9820 KB |
Output is correct |
44 |
Correct |
30 ms |
9708 KB |
Output is correct |
45 |
Correct |
31 ms |
9704 KB |
Output is correct |
46 |
Correct |
32 ms |
9816 KB |
Output is correct |
47 |
Correct |
132 ms |
14792 KB |
Output is correct |
48 |
Correct |
170 ms |
17352 KB |
Output is correct |
49 |
Correct |
193 ms |
17356 KB |
Output is correct |
50 |
Correct |
31 ms |
9816 KB |
Output is correct |
51 |
Correct |
29 ms |
9844 KB |
Output is correct |
52 |
Correct |
117 ms |
14888 KB |
Output is correct |
53 |
Correct |
168 ms |
17356 KB |
Output is correct |
54 |
Correct |
172 ms |
17356 KB |
Output is correct |
55 |
Correct |
34 ms |
9692 KB |
Output is correct |
56 |
Correct |
30 ms |
9816 KB |
Output is correct |
57 |
Correct |
114 ms |
14408 KB |
Output is correct |
58 |
Correct |
118 ms |
14856 KB |
Output is correct |
59 |
Correct |
128 ms |
14924 KB |
Output is correct |
60 |
Correct |
166 ms |
17356 KB |
Output is correct |
61 |
Correct |
167 ms |
17356 KB |
Output is correct |
62 |
Correct |
169 ms |
17200 KB |
Output is correct |
63 |
Correct |
182 ms |
17612 KB |
Output is correct |
64 |
Correct |
38 ms |
9696 KB |
Output is correct |
65 |
Correct |
38 ms |
9808 KB |
Output is correct |
66 |
Correct |
39 ms |
9816 KB |
Output is correct |
67 |
Correct |
32 ms |
9816 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2381 ms |
14796 KB |
Output is correct |
2 |
Correct |
3102 ms |
14796 KB |
Output is correct |
3 |
Correct |
3142 ms |
14800 KB |
Output is correct |
4 |
Correct |
3162 ms |
17448 KB |
Output is correct |
5 |
Correct |
3177 ms |
17356 KB |
Output is correct |
6 |
Correct |
3178 ms |
17356 KB |
Output is correct |
7 |
Correct |
3143 ms |
17356 KB |
Output is correct |
8 |
Correct |
2975 ms |
9816 KB |
Output is correct |
9 |
Correct |
2987 ms |
9812 KB |
Output is correct |
10 |
Correct |
3788 ms |
9816 KB |
Output is correct |
11 |
Correct |
3745 ms |
9816 KB |
Output is correct |
12 |
Correct |
2998 ms |
9816 KB |
Output is correct |
13 |
Correct |
3025 ms |
9816 KB |
Output is correct |
14 |
Correct |
4 ms |
8280 KB |
Output is correct |
15 |
Correct |
4 ms |
8280 KB |
Output is correct |
16 |
Correct |
4 ms |
8280 KB |
Output is correct |
17 |
Correct |
116 ms |
14792 KB |
Output is correct |
18 |
Correct |
180 ms |
17356 KB |
Output is correct |
19 |
Correct |
168 ms |
17392 KB |
Output is correct |
20 |
Correct |
32 ms |
9696 KB |
Output is correct |
21 |
Correct |
40 ms |
9808 KB |
Output is correct |
22 |
Correct |
116 ms |
14932 KB |
Output is correct |
23 |
Correct |
177 ms |
17616 KB |
Output is correct |
24 |
Correct |
182 ms |
17232 KB |
Output is correct |
25 |
Correct |
35 ms |
9704 KB |
Output is correct |
26 |
Correct |
32 ms |
9816 KB |
Output is correct |
27 |
Correct |
5 ms |
8280 KB |
Output is correct |
28 |
Correct |
5 ms |
8464 KB |
Output is correct |
29 |
Correct |
5 ms |
8280 KB |
Output is correct |
30 |
Correct |
4 ms |
8280 KB |
Output is correct |
31 |
Correct |
4 ms |
8280 KB |
Output is correct |
32 |
Correct |
6 ms |
8280 KB |
Output is correct |
33 |
Correct |
6 ms |
8280 KB |
Output is correct |
34 |
Correct |
5 ms |
8380 KB |
Output is correct |
35 |
Correct |
4 ms |
8280 KB |
Output is correct |
36 |
Correct |
4 ms |
8100 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
781 ms |
9824 KB |
Output is correct |
2 |
Execution timed out |
4032 ms |
14876 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
8280 KB |
Output is correct |
2 |
Correct |
5 ms |
8280 KB |
Output is correct |
3 |
Correct |
4 ms |
8280 KB |
Output is correct |
4 |
Correct |
5 ms |
8280 KB |
Output is correct |
5 |
Correct |
5 ms |
8280 KB |
Output is correct |
6 |
Correct |
5 ms |
8280 KB |
Output is correct |
7 |
Correct |
5 ms |
8280 KB |
Output is correct |
8 |
Correct |
4 ms |
8280 KB |
Output is correct |
9 |
Correct |
3 ms |
8304 KB |
Output is correct |
10 |
Correct |
4 ms |
8280 KB |
Output is correct |
11 |
Correct |
3 ms |
8280 KB |
Output is correct |
12 |
Correct |
3 ms |
8024 KB |
Output is correct |
13 |
Correct |
4 ms |
8280 KB |
Output is correct |
14 |
Correct |
6 ms |
8280 KB |
Output is correct |
15 |
Correct |
5 ms |
8280 KB |
Output is correct |
16 |
Correct |
6 ms |
8280 KB |
Output is correct |
17 |
Correct |
5 ms |
8280 KB |
Output is correct |
18 |
Correct |
3 ms |
8280 KB |
Output is correct |
19 |
Correct |
4 ms |
8532 KB |
Output is correct |
20 |
Correct |
6 ms |
8280 KB |
Output is correct |
21 |
Correct |
5 ms |
8280 KB |
Output is correct |
22 |
Correct |
5 ms |
8280 KB |
Output is correct |
23 |
Correct |
4 ms |
8280 KB |
Output is correct |
24 |
Correct |
4 ms |
8280 KB |
Output is correct |
25 |
Correct |
4 ms |
8280 KB |
Output is correct |
26 |
Correct |
5 ms |
8280 KB |
Output is correct |
27 |
Correct |
4 ms |
8280 KB |
Output is correct |
28 |
Correct |
5 ms |
8280 KB |
Output is correct |
29 |
Correct |
5 ms |
8280 KB |
Output is correct |
30 |
Correct |
7 ms |
8280 KB |
Output is correct |
31 |
Correct |
5 ms |
8280 KB |
Output is correct |
32 |
Correct |
4 ms |
8132 KB |
Output is correct |
33 |
Correct |
4 ms |
8280 KB |
Output is correct |
34 |
Correct |
3 ms |
8280 KB |
Output is correct |
35 |
Correct |
4 ms |
8280 KB |
Output is correct |
36 |
Correct |
73 ms |
12376 KB |
Output is correct |
37 |
Correct |
118 ms |
14684 KB |
Output is correct |
38 |
Correct |
119 ms |
14800 KB |
Output is correct |
39 |
Correct |
172 ms |
17356 KB |
Output is correct |
40 |
Correct |
169 ms |
17352 KB |
Output is correct |
41 |
Correct |
183 ms |
17356 KB |
Output is correct |
42 |
Correct |
172 ms |
17388 KB |
Output is correct |
43 |
Correct |
32 ms |
9820 KB |
Output is correct |
44 |
Correct |
30 ms |
9708 KB |
Output is correct |
45 |
Correct |
31 ms |
9704 KB |
Output is correct |
46 |
Correct |
32 ms |
9816 KB |
Output is correct |
47 |
Correct |
132 ms |
14792 KB |
Output is correct |
48 |
Correct |
170 ms |
17352 KB |
Output is correct |
49 |
Correct |
193 ms |
17356 KB |
Output is correct |
50 |
Correct |
31 ms |
9816 KB |
Output is correct |
51 |
Correct |
29 ms |
9844 KB |
Output is correct |
52 |
Correct |
117 ms |
14888 KB |
Output is correct |
53 |
Correct |
168 ms |
17356 KB |
Output is correct |
54 |
Correct |
172 ms |
17356 KB |
Output is correct |
55 |
Correct |
34 ms |
9692 KB |
Output is correct |
56 |
Correct |
30 ms |
9816 KB |
Output is correct |
57 |
Correct |
114 ms |
14408 KB |
Output is correct |
58 |
Correct |
118 ms |
14856 KB |
Output is correct |
59 |
Correct |
128 ms |
14924 KB |
Output is correct |
60 |
Correct |
166 ms |
17356 KB |
Output is correct |
61 |
Correct |
167 ms |
17356 KB |
Output is correct |
62 |
Correct |
169 ms |
17200 KB |
Output is correct |
63 |
Correct |
182 ms |
17612 KB |
Output is correct |
64 |
Correct |
38 ms |
9696 KB |
Output is correct |
65 |
Correct |
38 ms |
9808 KB |
Output is correct |
66 |
Correct |
39 ms |
9816 KB |
Output is correct |
67 |
Correct |
32 ms |
9816 KB |
Output is correct |
68 |
Correct |
2381 ms |
14796 KB |
Output is correct |
69 |
Correct |
3102 ms |
14796 KB |
Output is correct |
70 |
Correct |
3142 ms |
14800 KB |
Output is correct |
71 |
Correct |
3162 ms |
17448 KB |
Output is correct |
72 |
Correct |
3177 ms |
17356 KB |
Output is correct |
73 |
Correct |
3178 ms |
17356 KB |
Output is correct |
74 |
Correct |
3143 ms |
17356 KB |
Output is correct |
75 |
Correct |
2975 ms |
9816 KB |
Output is correct |
76 |
Correct |
2987 ms |
9812 KB |
Output is correct |
77 |
Correct |
3788 ms |
9816 KB |
Output is correct |
78 |
Correct |
3745 ms |
9816 KB |
Output is correct |
79 |
Correct |
2998 ms |
9816 KB |
Output is correct |
80 |
Correct |
3025 ms |
9816 KB |
Output is correct |
81 |
Correct |
4 ms |
8280 KB |
Output is correct |
82 |
Correct |
4 ms |
8280 KB |
Output is correct |
83 |
Correct |
4 ms |
8280 KB |
Output is correct |
84 |
Correct |
116 ms |
14792 KB |
Output is correct |
85 |
Correct |
180 ms |
17356 KB |
Output is correct |
86 |
Correct |
168 ms |
17392 KB |
Output is correct |
87 |
Correct |
32 ms |
9696 KB |
Output is correct |
88 |
Correct |
40 ms |
9808 KB |
Output is correct |
89 |
Correct |
116 ms |
14932 KB |
Output is correct |
90 |
Correct |
177 ms |
17616 KB |
Output is correct |
91 |
Correct |
182 ms |
17232 KB |
Output is correct |
92 |
Correct |
35 ms |
9704 KB |
Output is correct |
93 |
Correct |
32 ms |
9816 KB |
Output is correct |
94 |
Correct |
5 ms |
8280 KB |
Output is correct |
95 |
Correct |
5 ms |
8464 KB |
Output is correct |
96 |
Correct |
5 ms |
8280 KB |
Output is correct |
97 |
Correct |
4 ms |
8280 KB |
Output is correct |
98 |
Correct |
4 ms |
8280 KB |
Output is correct |
99 |
Correct |
6 ms |
8280 KB |
Output is correct |
100 |
Correct |
6 ms |
8280 KB |
Output is correct |
101 |
Correct |
5 ms |
8380 KB |
Output is correct |
102 |
Correct |
4 ms |
8280 KB |
Output is correct |
103 |
Correct |
4 ms |
8100 KB |
Output is correct |
104 |
Correct |
2484 ms |
13904 KB |
Output is correct |
105 |
Correct |
3181 ms |
14916 KB |
Output is correct |
106 |
Correct |
3154 ms |
14668 KB |
Output is correct |
107 |
Correct |
3182 ms |
17356 KB |
Output is correct |
108 |
Correct |
3180 ms |
17408 KB |
Output is correct |
109 |
Correct |
3269 ms |
17356 KB |
Output is correct |
110 |
Correct |
3183 ms |
17356 KB |
Output is correct |
111 |
Correct |
3006 ms |
9816 KB |
Output is correct |
112 |
Correct |
3101 ms |
9756 KB |
Output is correct |
113 |
Correct |
3572 ms |
9816 KB |
Output is correct |
114 |
Execution timed out |
4003 ms |
9816 KB |
Time limit exceeded |
115 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
993 ms |
9048 KB |
Output is correct |
2 |
Correct |
3044 ms |
9816 KB |
Output is correct |
3 |
Correct |
3023 ms |
9816 KB |
Output is correct |
4 |
Correct |
3087 ms |
9816 KB |
Output is correct |
5 |
Correct |
3036 ms |
9816 KB |
Output is correct |
6 |
Correct |
3005 ms |
9816 KB |
Output is correct |
7 |
Correct |
2982 ms |
9816 KB |
Output is correct |
8 |
Correct |
3 ms |
8280 KB |
Output is correct |
9 |
Correct |
4 ms |
8280 KB |
Output is correct |
10 |
Correct |
3 ms |
8280 KB |
Output is correct |
11 |
Correct |
3 ms |
8280 KB |
Output is correct |
12 |
Correct |
5 ms |
8280 KB |
Output is correct |
13 |
Correct |
4 ms |
8280 KB |
Output is correct |
14 |
Correct |
5 ms |
8280 KB |
Output is correct |
15 |
Correct |
5 ms |
8280 KB |
Output is correct |
16 |
Correct |
5 ms |
8280 KB |
Output is correct |
17 |
Correct |
5 ms |
8280 KB |
Output is correct |
18 |
Correct |
4 ms |
8280 KB |
Output is correct |
19 |
Correct |
3 ms |
8304 KB |
Output is correct |
20 |
Correct |
4 ms |
8280 KB |
Output is correct |
21 |
Correct |
3 ms |
8280 KB |
Output is correct |
22 |
Correct |
3 ms |
8024 KB |
Output is correct |
23 |
Correct |
4 ms |
8280 KB |
Output is correct |
24 |
Correct |
6 ms |
8280 KB |
Output is correct |
25 |
Correct |
5 ms |
8280 KB |
Output is correct |
26 |
Correct |
6 ms |
8280 KB |
Output is correct |
27 |
Correct |
5 ms |
8280 KB |
Output is correct |
28 |
Correct |
3 ms |
8280 KB |
Output is correct |
29 |
Correct |
4 ms |
8532 KB |
Output is correct |
30 |
Correct |
6 ms |
8280 KB |
Output is correct |
31 |
Correct |
5 ms |
8280 KB |
Output is correct |
32 |
Correct |
5 ms |
8280 KB |
Output is correct |
33 |
Correct |
4 ms |
8280 KB |
Output is correct |
34 |
Correct |
4 ms |
8280 KB |
Output is correct |
35 |
Correct |
4 ms |
8280 KB |
Output is correct |
36 |
Correct |
5 ms |
8280 KB |
Output is correct |
37 |
Correct |
4 ms |
8280 KB |
Output is correct |
38 |
Correct |
5 ms |
8280 KB |
Output is correct |
39 |
Correct |
5 ms |
8280 KB |
Output is correct |
40 |
Correct |
7 ms |
8280 KB |
Output is correct |
41 |
Correct |
5 ms |
8280 KB |
Output is correct |
42 |
Correct |
4 ms |
8132 KB |
Output is correct |
43 |
Correct |
4 ms |
8280 KB |
Output is correct |
44 |
Correct |
3 ms |
8280 KB |
Output is correct |
45 |
Correct |
4 ms |
8280 KB |
Output is correct |
46 |
Correct |
73 ms |
12376 KB |
Output is correct |
47 |
Correct |
118 ms |
14684 KB |
Output is correct |
48 |
Correct |
119 ms |
14800 KB |
Output is correct |
49 |
Correct |
172 ms |
17356 KB |
Output is correct |
50 |
Correct |
169 ms |
17352 KB |
Output is correct |
51 |
Correct |
183 ms |
17356 KB |
Output is correct |
52 |
Correct |
172 ms |
17388 KB |
Output is correct |
53 |
Correct |
32 ms |
9820 KB |
Output is correct |
54 |
Correct |
30 ms |
9708 KB |
Output is correct |
55 |
Correct |
31 ms |
9704 KB |
Output is correct |
56 |
Correct |
32 ms |
9816 KB |
Output is correct |
57 |
Correct |
132 ms |
14792 KB |
Output is correct |
58 |
Correct |
170 ms |
17352 KB |
Output is correct |
59 |
Correct |
193 ms |
17356 KB |
Output is correct |
60 |
Correct |
31 ms |
9816 KB |
Output is correct |
61 |
Correct |
29 ms |
9844 KB |
Output is correct |
62 |
Correct |
117 ms |
14888 KB |
Output is correct |
63 |
Correct |
168 ms |
17356 KB |
Output is correct |
64 |
Correct |
172 ms |
17356 KB |
Output is correct |
65 |
Correct |
34 ms |
9692 KB |
Output is correct |
66 |
Correct |
30 ms |
9816 KB |
Output is correct |
67 |
Correct |
114 ms |
14408 KB |
Output is correct |
68 |
Correct |
118 ms |
14856 KB |
Output is correct |
69 |
Correct |
128 ms |
14924 KB |
Output is correct |
70 |
Correct |
166 ms |
17356 KB |
Output is correct |
71 |
Correct |
167 ms |
17356 KB |
Output is correct |
72 |
Correct |
169 ms |
17200 KB |
Output is correct |
73 |
Correct |
182 ms |
17612 KB |
Output is correct |
74 |
Correct |
38 ms |
9696 KB |
Output is correct |
75 |
Correct |
38 ms |
9808 KB |
Output is correct |
76 |
Correct |
39 ms |
9816 KB |
Output is correct |
77 |
Correct |
32 ms |
9816 KB |
Output is correct |
78 |
Correct |
2381 ms |
14796 KB |
Output is correct |
79 |
Correct |
3102 ms |
14796 KB |
Output is correct |
80 |
Correct |
3142 ms |
14800 KB |
Output is correct |
81 |
Correct |
3162 ms |
17448 KB |
Output is correct |
82 |
Correct |
3177 ms |
17356 KB |
Output is correct |
83 |
Correct |
3178 ms |
17356 KB |
Output is correct |
84 |
Correct |
3143 ms |
17356 KB |
Output is correct |
85 |
Correct |
2975 ms |
9816 KB |
Output is correct |
86 |
Correct |
2987 ms |
9812 KB |
Output is correct |
87 |
Correct |
3788 ms |
9816 KB |
Output is correct |
88 |
Correct |
3745 ms |
9816 KB |
Output is correct |
89 |
Correct |
2998 ms |
9816 KB |
Output is correct |
90 |
Correct |
3025 ms |
9816 KB |
Output is correct |
91 |
Correct |
4 ms |
8280 KB |
Output is correct |
92 |
Correct |
4 ms |
8280 KB |
Output is correct |
93 |
Correct |
4 ms |
8280 KB |
Output is correct |
94 |
Correct |
116 ms |
14792 KB |
Output is correct |
95 |
Correct |
180 ms |
17356 KB |
Output is correct |
96 |
Correct |
168 ms |
17392 KB |
Output is correct |
97 |
Correct |
32 ms |
9696 KB |
Output is correct |
98 |
Correct |
40 ms |
9808 KB |
Output is correct |
99 |
Correct |
116 ms |
14932 KB |
Output is correct |
100 |
Correct |
177 ms |
17616 KB |
Output is correct |
101 |
Correct |
182 ms |
17232 KB |
Output is correct |
102 |
Correct |
35 ms |
9704 KB |
Output is correct |
103 |
Correct |
32 ms |
9816 KB |
Output is correct |
104 |
Correct |
5 ms |
8280 KB |
Output is correct |
105 |
Correct |
5 ms |
8464 KB |
Output is correct |
106 |
Correct |
5 ms |
8280 KB |
Output is correct |
107 |
Correct |
4 ms |
8280 KB |
Output is correct |
108 |
Correct |
4 ms |
8280 KB |
Output is correct |
109 |
Correct |
6 ms |
8280 KB |
Output is correct |
110 |
Correct |
6 ms |
8280 KB |
Output is correct |
111 |
Correct |
5 ms |
8380 KB |
Output is correct |
112 |
Correct |
4 ms |
8280 KB |
Output is correct |
113 |
Correct |
4 ms |
8100 KB |
Output is correct |
114 |
Correct |
781 ms |
9824 KB |
Output is correct |
115 |
Execution timed out |
4032 ms |
14876 KB |
Time limit exceeded |
116 |
Halted |
0 ms |
0 KB |
- |