#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:6: warning: unused variable 'n' [-Wunused-variable]
280 | int n = a.size();
| ^
towers.cpp:296:7: warning: variable 'get01' set but not used [-Wunused-but-set-variable]
296 | auto get01 = [&](int l, int r, int d){
| ^~~~~
towers.cpp:307:7: 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 |
994 ms |
8972 KB |
Output is correct |
2 |
Correct |
3064 ms |
9680 KB |
Output is correct |
3 |
Correct |
2894 ms |
9664 KB |
Output is correct |
4 |
Correct |
2982 ms |
9688 KB |
Output is correct |
5 |
Correct |
3008 ms |
9656 KB |
Output is correct |
6 |
Correct |
2869 ms |
9664 KB |
Output is correct |
7 |
Correct |
2857 ms |
9672 KB |
Output is correct |
8 |
Correct |
3 ms |
8144 KB |
Output is correct |
9 |
Correct |
4 ms |
8144 KB |
Output is correct |
10 |
Correct |
4 ms |
8144 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
8144 KB |
Output is correct |
2 |
Correct |
5 ms |
8144 KB |
Output is correct |
3 |
Correct |
6 ms |
8280 KB |
Output is correct |
4 |
Correct |
5 ms |
8304 KB |
Output is correct |
5 |
Correct |
5 ms |
8328 KB |
Output is correct |
6 |
Correct |
5 ms |
8332 KB |
Output is correct |
7 |
Correct |
5 ms |
8320 KB |
Output is correct |
8 |
Correct |
4 ms |
8144 KB |
Output is correct |
9 |
Correct |
4 ms |
8144 KB |
Output is correct |
10 |
Correct |
4 ms |
8144 KB |
Output is correct |
11 |
Correct |
4 ms |
8060 KB |
Output is correct |
12 |
Correct |
3 ms |
8016 KB |
Output is correct |
13 |
Correct |
4 ms |
8144 KB |
Output is correct |
14 |
Correct |
4 ms |
8144 KB |
Output is correct |
15 |
Correct |
5 ms |
8272 KB |
Output is correct |
16 |
Correct |
5 ms |
8272 KB |
Output is correct |
17 |
Correct |
5 ms |
8328 KB |
Output is correct |
18 |
Correct |
4 ms |
8144 KB |
Output is correct |
19 |
Correct |
4 ms |
8144 KB |
Output is correct |
20 |
Correct |
5 ms |
8144 KB |
Output is correct |
21 |
Correct |
7 ms |
8272 KB |
Output is correct |
22 |
Correct |
7 ms |
8272 KB |
Output is correct |
23 |
Correct |
4 ms |
8144 KB |
Output is correct |
24 |
Correct |
4 ms |
8144 KB |
Output is correct |
25 |
Correct |
4 ms |
8144 KB |
Output is correct |
26 |
Correct |
5 ms |
8224 KB |
Output is correct |
27 |
Correct |
5 ms |
8200 KB |
Output is correct |
28 |
Correct |
5 ms |
8272 KB |
Output is correct |
29 |
Correct |
6 ms |
8272 KB |
Output is correct |
30 |
Correct |
6 ms |
8272 KB |
Output is correct |
31 |
Correct |
5 ms |
8272 KB |
Output is correct |
32 |
Correct |
4 ms |
8144 KB |
Output is correct |
33 |
Correct |
4 ms |
8144 KB |
Output is correct |
34 |
Correct |
4 ms |
8144 KB |
Output is correct |
35 |
Correct |
4 ms |
8144 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
8144 KB |
Output is correct |
2 |
Correct |
5 ms |
8144 KB |
Output is correct |
3 |
Correct |
6 ms |
8280 KB |
Output is correct |
4 |
Correct |
5 ms |
8304 KB |
Output is correct |
5 |
Correct |
5 ms |
8328 KB |
Output is correct |
6 |
Correct |
5 ms |
8332 KB |
Output is correct |
7 |
Correct |
5 ms |
8320 KB |
Output is correct |
8 |
Correct |
4 ms |
8144 KB |
Output is correct |
9 |
Correct |
4 ms |
8144 KB |
Output is correct |
10 |
Correct |
4 ms |
8144 KB |
Output is correct |
11 |
Correct |
4 ms |
8060 KB |
Output is correct |
12 |
Correct |
3 ms |
8016 KB |
Output is correct |
13 |
Correct |
4 ms |
8144 KB |
Output is correct |
14 |
Correct |
4 ms |
8144 KB |
Output is correct |
15 |
Correct |
5 ms |
8272 KB |
Output is correct |
16 |
Correct |
5 ms |
8272 KB |
Output is correct |
17 |
Correct |
5 ms |
8328 KB |
Output is correct |
18 |
Correct |
4 ms |
8144 KB |
Output is correct |
19 |
Correct |
4 ms |
8144 KB |
Output is correct |
20 |
Correct |
5 ms |
8144 KB |
Output is correct |
21 |
Correct |
7 ms |
8272 KB |
Output is correct |
22 |
Correct |
7 ms |
8272 KB |
Output is correct |
23 |
Correct |
4 ms |
8144 KB |
Output is correct |
24 |
Correct |
4 ms |
8144 KB |
Output is correct |
25 |
Correct |
4 ms |
8144 KB |
Output is correct |
26 |
Correct |
5 ms |
8224 KB |
Output is correct |
27 |
Correct |
5 ms |
8200 KB |
Output is correct |
28 |
Correct |
5 ms |
8272 KB |
Output is correct |
29 |
Correct |
6 ms |
8272 KB |
Output is correct |
30 |
Correct |
6 ms |
8272 KB |
Output is correct |
31 |
Correct |
5 ms |
8272 KB |
Output is correct |
32 |
Correct |
4 ms |
8144 KB |
Output is correct |
33 |
Correct |
4 ms |
8144 KB |
Output is correct |
34 |
Correct |
4 ms |
8144 KB |
Output is correct |
35 |
Correct |
4 ms |
8144 KB |
Output is correct |
36 |
Correct |
95 ms |
12404 KB |
Output is correct |
37 |
Correct |
132 ms |
14760 KB |
Output is correct |
38 |
Correct |
125 ms |
14880 KB |
Output is correct |
39 |
Correct |
191 ms |
17284 KB |
Output is correct |
40 |
Correct |
187 ms |
17356 KB |
Output is correct |
41 |
Correct |
193 ms |
17224 KB |
Output is correct |
42 |
Correct |
190 ms |
17196 KB |
Output is correct |
43 |
Correct |
35 ms |
9672 KB |
Output is correct |
44 |
Correct |
35 ms |
9692 KB |
Output is correct |
45 |
Correct |
38 ms |
9668 KB |
Output is correct |
46 |
Correct |
36 ms |
9668 KB |
Output is correct |
47 |
Correct |
128 ms |
14780 KB |
Output is correct |
48 |
Correct |
197 ms |
17312 KB |
Output is correct |
49 |
Correct |
188 ms |
17352 KB |
Output is correct |
50 |
Correct |
36 ms |
9692 KB |
Output is correct |
51 |
Correct |
44 ms |
9692 KB |
Output is correct |
52 |
Correct |
132 ms |
14820 KB |
Output is correct |
53 |
Correct |
231 ms |
17260 KB |
Output is correct |
54 |
Correct |
176 ms |
17224 KB |
Output is correct |
55 |
Correct |
37 ms |
9684 KB |
Output is correct |
56 |
Correct |
36 ms |
9688 KB |
Output is correct |
57 |
Correct |
129 ms |
14284 KB |
Output is correct |
58 |
Correct |
143 ms |
14740 KB |
Output is correct |
59 |
Correct |
123 ms |
14728 KB |
Output is correct |
60 |
Correct |
185 ms |
17208 KB |
Output is correct |
61 |
Correct |
183 ms |
17220 KB |
Output is correct |
62 |
Correct |
209 ms |
17348 KB |
Output is correct |
63 |
Correct |
173 ms |
17220 KB |
Output is correct |
64 |
Correct |
43 ms |
9684 KB |
Output is correct |
65 |
Correct |
48 ms |
9680 KB |
Output is correct |
66 |
Correct |
38 ms |
9696 KB |
Output is correct |
67 |
Correct |
42 ms |
9672 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2262 ms |
14788 KB |
Output is correct |
2 |
Correct |
2835 ms |
14788 KB |
Output is correct |
3 |
Correct |
3021 ms |
14856 KB |
Output is correct |
4 |
Correct |
3046 ms |
17236 KB |
Output is correct |
5 |
Correct |
3049 ms |
17220 KB |
Output is correct |
6 |
Correct |
3042 ms |
17256 KB |
Output is correct |
7 |
Correct |
3012 ms |
17288 KB |
Output is correct |
8 |
Correct |
2918 ms |
9668 KB |
Output is correct |
9 |
Correct |
2786 ms |
9668 KB |
Output is correct |
10 |
Correct |
3954 ms |
9692 KB |
Output is correct |
11 |
Correct |
3817 ms |
9672 KB |
Output is correct |
12 |
Correct |
2880 ms |
9692 KB |
Output is correct |
13 |
Correct |
2776 ms |
9704 KB |
Output is correct |
14 |
Correct |
3 ms |
8016 KB |
Output is correct |
15 |
Correct |
4 ms |
8144 KB |
Output is correct |
16 |
Correct |
4 ms |
8144 KB |
Output is correct |
17 |
Correct |
122 ms |
14788 KB |
Output is correct |
18 |
Correct |
187 ms |
17228 KB |
Output is correct |
19 |
Correct |
179 ms |
17228 KB |
Output is correct |
20 |
Correct |
35 ms |
9688 KB |
Output is correct |
21 |
Correct |
35 ms |
9692 KB |
Output is correct |
22 |
Correct |
123 ms |
14788 KB |
Output is correct |
23 |
Correct |
175 ms |
17208 KB |
Output is correct |
24 |
Correct |
192 ms |
17224 KB |
Output is correct |
25 |
Correct |
36 ms |
9664 KB |
Output is correct |
26 |
Correct |
38 ms |
9672 KB |
Output is correct |
27 |
Correct |
5 ms |
8272 KB |
Output is correct |
28 |
Correct |
6 ms |
8272 KB |
Output is correct |
29 |
Correct |
5 ms |
8272 KB |
Output is correct |
30 |
Correct |
4 ms |
8144 KB |
Output is correct |
31 |
Correct |
4 ms |
8164 KB |
Output is correct |
32 |
Correct |
5 ms |
8272 KB |
Output is correct |
33 |
Correct |
5 ms |
8272 KB |
Output is correct |
34 |
Correct |
6 ms |
8272 KB |
Output is correct |
35 |
Correct |
4 ms |
8144 KB |
Output is correct |
36 |
Correct |
4 ms |
8144 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
755 ms |
9688 KB |
Output is correct |
2 |
Execution timed out |
4049 ms |
14788 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
8144 KB |
Output is correct |
2 |
Correct |
5 ms |
8144 KB |
Output is correct |
3 |
Correct |
6 ms |
8280 KB |
Output is correct |
4 |
Correct |
5 ms |
8304 KB |
Output is correct |
5 |
Correct |
5 ms |
8328 KB |
Output is correct |
6 |
Correct |
5 ms |
8332 KB |
Output is correct |
7 |
Correct |
5 ms |
8320 KB |
Output is correct |
8 |
Correct |
4 ms |
8144 KB |
Output is correct |
9 |
Correct |
4 ms |
8144 KB |
Output is correct |
10 |
Correct |
4 ms |
8144 KB |
Output is correct |
11 |
Correct |
4 ms |
8060 KB |
Output is correct |
12 |
Correct |
3 ms |
8016 KB |
Output is correct |
13 |
Correct |
4 ms |
8144 KB |
Output is correct |
14 |
Correct |
4 ms |
8144 KB |
Output is correct |
15 |
Correct |
5 ms |
8272 KB |
Output is correct |
16 |
Correct |
5 ms |
8272 KB |
Output is correct |
17 |
Correct |
5 ms |
8328 KB |
Output is correct |
18 |
Correct |
4 ms |
8144 KB |
Output is correct |
19 |
Correct |
4 ms |
8144 KB |
Output is correct |
20 |
Correct |
5 ms |
8144 KB |
Output is correct |
21 |
Correct |
7 ms |
8272 KB |
Output is correct |
22 |
Correct |
7 ms |
8272 KB |
Output is correct |
23 |
Correct |
4 ms |
8144 KB |
Output is correct |
24 |
Correct |
4 ms |
8144 KB |
Output is correct |
25 |
Correct |
4 ms |
8144 KB |
Output is correct |
26 |
Correct |
5 ms |
8224 KB |
Output is correct |
27 |
Correct |
5 ms |
8200 KB |
Output is correct |
28 |
Correct |
5 ms |
8272 KB |
Output is correct |
29 |
Correct |
6 ms |
8272 KB |
Output is correct |
30 |
Correct |
6 ms |
8272 KB |
Output is correct |
31 |
Correct |
5 ms |
8272 KB |
Output is correct |
32 |
Correct |
4 ms |
8144 KB |
Output is correct |
33 |
Correct |
4 ms |
8144 KB |
Output is correct |
34 |
Correct |
4 ms |
8144 KB |
Output is correct |
35 |
Correct |
4 ms |
8144 KB |
Output is correct |
36 |
Correct |
95 ms |
12404 KB |
Output is correct |
37 |
Correct |
132 ms |
14760 KB |
Output is correct |
38 |
Correct |
125 ms |
14880 KB |
Output is correct |
39 |
Correct |
191 ms |
17284 KB |
Output is correct |
40 |
Correct |
187 ms |
17356 KB |
Output is correct |
41 |
Correct |
193 ms |
17224 KB |
Output is correct |
42 |
Correct |
190 ms |
17196 KB |
Output is correct |
43 |
Correct |
35 ms |
9672 KB |
Output is correct |
44 |
Correct |
35 ms |
9692 KB |
Output is correct |
45 |
Correct |
38 ms |
9668 KB |
Output is correct |
46 |
Correct |
36 ms |
9668 KB |
Output is correct |
47 |
Correct |
128 ms |
14780 KB |
Output is correct |
48 |
Correct |
197 ms |
17312 KB |
Output is correct |
49 |
Correct |
188 ms |
17352 KB |
Output is correct |
50 |
Correct |
36 ms |
9692 KB |
Output is correct |
51 |
Correct |
44 ms |
9692 KB |
Output is correct |
52 |
Correct |
132 ms |
14820 KB |
Output is correct |
53 |
Correct |
231 ms |
17260 KB |
Output is correct |
54 |
Correct |
176 ms |
17224 KB |
Output is correct |
55 |
Correct |
37 ms |
9684 KB |
Output is correct |
56 |
Correct |
36 ms |
9688 KB |
Output is correct |
57 |
Correct |
129 ms |
14284 KB |
Output is correct |
58 |
Correct |
143 ms |
14740 KB |
Output is correct |
59 |
Correct |
123 ms |
14728 KB |
Output is correct |
60 |
Correct |
185 ms |
17208 KB |
Output is correct |
61 |
Correct |
183 ms |
17220 KB |
Output is correct |
62 |
Correct |
209 ms |
17348 KB |
Output is correct |
63 |
Correct |
173 ms |
17220 KB |
Output is correct |
64 |
Correct |
43 ms |
9684 KB |
Output is correct |
65 |
Correct |
48 ms |
9680 KB |
Output is correct |
66 |
Correct |
38 ms |
9696 KB |
Output is correct |
67 |
Correct |
42 ms |
9672 KB |
Output is correct |
68 |
Correct |
2262 ms |
14788 KB |
Output is correct |
69 |
Correct |
2835 ms |
14788 KB |
Output is correct |
70 |
Correct |
3021 ms |
14856 KB |
Output is correct |
71 |
Correct |
3046 ms |
17236 KB |
Output is correct |
72 |
Correct |
3049 ms |
17220 KB |
Output is correct |
73 |
Correct |
3042 ms |
17256 KB |
Output is correct |
74 |
Correct |
3012 ms |
17288 KB |
Output is correct |
75 |
Correct |
2918 ms |
9668 KB |
Output is correct |
76 |
Correct |
2786 ms |
9668 KB |
Output is correct |
77 |
Correct |
3954 ms |
9692 KB |
Output is correct |
78 |
Correct |
3817 ms |
9672 KB |
Output is correct |
79 |
Correct |
2880 ms |
9692 KB |
Output is correct |
80 |
Correct |
2776 ms |
9704 KB |
Output is correct |
81 |
Correct |
3 ms |
8016 KB |
Output is correct |
82 |
Correct |
4 ms |
8144 KB |
Output is correct |
83 |
Correct |
4 ms |
8144 KB |
Output is correct |
84 |
Correct |
122 ms |
14788 KB |
Output is correct |
85 |
Correct |
187 ms |
17228 KB |
Output is correct |
86 |
Correct |
179 ms |
17228 KB |
Output is correct |
87 |
Correct |
35 ms |
9688 KB |
Output is correct |
88 |
Correct |
35 ms |
9692 KB |
Output is correct |
89 |
Correct |
123 ms |
14788 KB |
Output is correct |
90 |
Correct |
175 ms |
17208 KB |
Output is correct |
91 |
Correct |
192 ms |
17224 KB |
Output is correct |
92 |
Correct |
36 ms |
9664 KB |
Output is correct |
93 |
Correct |
38 ms |
9672 KB |
Output is correct |
94 |
Correct |
5 ms |
8272 KB |
Output is correct |
95 |
Correct |
6 ms |
8272 KB |
Output is correct |
96 |
Correct |
5 ms |
8272 KB |
Output is correct |
97 |
Correct |
4 ms |
8144 KB |
Output is correct |
98 |
Correct |
4 ms |
8164 KB |
Output is correct |
99 |
Correct |
5 ms |
8272 KB |
Output is correct |
100 |
Correct |
5 ms |
8272 KB |
Output is correct |
101 |
Correct |
6 ms |
8272 KB |
Output is correct |
102 |
Correct |
4 ms |
8144 KB |
Output is correct |
103 |
Correct |
4 ms |
8144 KB |
Output is correct |
104 |
Correct |
2383 ms |
13836 KB |
Output is correct |
105 |
Correct |
2788 ms |
14792 KB |
Output is correct |
106 |
Correct |
2909 ms |
14788 KB |
Output is correct |
107 |
Correct |
2766 ms |
17240 KB |
Output is correct |
108 |
Correct |
2868 ms |
17284 KB |
Output is correct |
109 |
Correct |
3086 ms |
17460 KB |
Output is correct |
110 |
Correct |
2930 ms |
17228 KB |
Output is correct |
111 |
Correct |
2891 ms |
9668 KB |
Output is correct |
112 |
Correct |
2739 ms |
9680 KB |
Output is correct |
113 |
Correct |
3540 ms |
9672 KB |
Output is correct |
114 |
Execution timed out |
4003 ms |
9668 KB |
Time limit exceeded |
115 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
994 ms |
8972 KB |
Output is correct |
2 |
Correct |
3064 ms |
9680 KB |
Output is correct |
3 |
Correct |
2894 ms |
9664 KB |
Output is correct |
4 |
Correct |
2982 ms |
9688 KB |
Output is correct |
5 |
Correct |
3008 ms |
9656 KB |
Output is correct |
6 |
Correct |
2869 ms |
9664 KB |
Output is correct |
7 |
Correct |
2857 ms |
9672 KB |
Output is correct |
8 |
Correct |
3 ms |
8144 KB |
Output is correct |
9 |
Correct |
4 ms |
8144 KB |
Output is correct |
10 |
Correct |
4 ms |
8144 KB |
Output is correct |
11 |
Correct |
5 ms |
8144 KB |
Output is correct |
12 |
Correct |
5 ms |
8144 KB |
Output is correct |
13 |
Correct |
6 ms |
8280 KB |
Output is correct |
14 |
Correct |
5 ms |
8304 KB |
Output is correct |
15 |
Correct |
5 ms |
8328 KB |
Output is correct |
16 |
Correct |
5 ms |
8332 KB |
Output is correct |
17 |
Correct |
5 ms |
8320 KB |
Output is correct |
18 |
Correct |
4 ms |
8144 KB |
Output is correct |
19 |
Correct |
4 ms |
8144 KB |
Output is correct |
20 |
Correct |
4 ms |
8144 KB |
Output is correct |
21 |
Correct |
4 ms |
8060 KB |
Output is correct |
22 |
Correct |
3 ms |
8016 KB |
Output is correct |
23 |
Correct |
4 ms |
8144 KB |
Output is correct |
24 |
Correct |
4 ms |
8144 KB |
Output is correct |
25 |
Correct |
5 ms |
8272 KB |
Output is correct |
26 |
Correct |
5 ms |
8272 KB |
Output is correct |
27 |
Correct |
5 ms |
8328 KB |
Output is correct |
28 |
Correct |
4 ms |
8144 KB |
Output is correct |
29 |
Correct |
4 ms |
8144 KB |
Output is correct |
30 |
Correct |
5 ms |
8144 KB |
Output is correct |
31 |
Correct |
7 ms |
8272 KB |
Output is correct |
32 |
Correct |
7 ms |
8272 KB |
Output is correct |
33 |
Correct |
4 ms |
8144 KB |
Output is correct |
34 |
Correct |
4 ms |
8144 KB |
Output is correct |
35 |
Correct |
4 ms |
8144 KB |
Output is correct |
36 |
Correct |
5 ms |
8224 KB |
Output is correct |
37 |
Correct |
5 ms |
8200 KB |
Output is correct |
38 |
Correct |
5 ms |
8272 KB |
Output is correct |
39 |
Correct |
6 ms |
8272 KB |
Output is correct |
40 |
Correct |
6 ms |
8272 KB |
Output is correct |
41 |
Correct |
5 ms |
8272 KB |
Output is correct |
42 |
Correct |
4 ms |
8144 KB |
Output is correct |
43 |
Correct |
4 ms |
8144 KB |
Output is correct |
44 |
Correct |
4 ms |
8144 KB |
Output is correct |
45 |
Correct |
4 ms |
8144 KB |
Output is correct |
46 |
Correct |
95 ms |
12404 KB |
Output is correct |
47 |
Correct |
132 ms |
14760 KB |
Output is correct |
48 |
Correct |
125 ms |
14880 KB |
Output is correct |
49 |
Correct |
191 ms |
17284 KB |
Output is correct |
50 |
Correct |
187 ms |
17356 KB |
Output is correct |
51 |
Correct |
193 ms |
17224 KB |
Output is correct |
52 |
Correct |
190 ms |
17196 KB |
Output is correct |
53 |
Correct |
35 ms |
9672 KB |
Output is correct |
54 |
Correct |
35 ms |
9692 KB |
Output is correct |
55 |
Correct |
38 ms |
9668 KB |
Output is correct |
56 |
Correct |
36 ms |
9668 KB |
Output is correct |
57 |
Correct |
128 ms |
14780 KB |
Output is correct |
58 |
Correct |
197 ms |
17312 KB |
Output is correct |
59 |
Correct |
188 ms |
17352 KB |
Output is correct |
60 |
Correct |
36 ms |
9692 KB |
Output is correct |
61 |
Correct |
44 ms |
9692 KB |
Output is correct |
62 |
Correct |
132 ms |
14820 KB |
Output is correct |
63 |
Correct |
231 ms |
17260 KB |
Output is correct |
64 |
Correct |
176 ms |
17224 KB |
Output is correct |
65 |
Correct |
37 ms |
9684 KB |
Output is correct |
66 |
Correct |
36 ms |
9688 KB |
Output is correct |
67 |
Correct |
129 ms |
14284 KB |
Output is correct |
68 |
Correct |
143 ms |
14740 KB |
Output is correct |
69 |
Correct |
123 ms |
14728 KB |
Output is correct |
70 |
Correct |
185 ms |
17208 KB |
Output is correct |
71 |
Correct |
183 ms |
17220 KB |
Output is correct |
72 |
Correct |
209 ms |
17348 KB |
Output is correct |
73 |
Correct |
173 ms |
17220 KB |
Output is correct |
74 |
Correct |
43 ms |
9684 KB |
Output is correct |
75 |
Correct |
48 ms |
9680 KB |
Output is correct |
76 |
Correct |
38 ms |
9696 KB |
Output is correct |
77 |
Correct |
42 ms |
9672 KB |
Output is correct |
78 |
Correct |
2262 ms |
14788 KB |
Output is correct |
79 |
Correct |
2835 ms |
14788 KB |
Output is correct |
80 |
Correct |
3021 ms |
14856 KB |
Output is correct |
81 |
Correct |
3046 ms |
17236 KB |
Output is correct |
82 |
Correct |
3049 ms |
17220 KB |
Output is correct |
83 |
Correct |
3042 ms |
17256 KB |
Output is correct |
84 |
Correct |
3012 ms |
17288 KB |
Output is correct |
85 |
Correct |
2918 ms |
9668 KB |
Output is correct |
86 |
Correct |
2786 ms |
9668 KB |
Output is correct |
87 |
Correct |
3954 ms |
9692 KB |
Output is correct |
88 |
Correct |
3817 ms |
9672 KB |
Output is correct |
89 |
Correct |
2880 ms |
9692 KB |
Output is correct |
90 |
Correct |
2776 ms |
9704 KB |
Output is correct |
91 |
Correct |
3 ms |
8016 KB |
Output is correct |
92 |
Correct |
4 ms |
8144 KB |
Output is correct |
93 |
Correct |
4 ms |
8144 KB |
Output is correct |
94 |
Correct |
122 ms |
14788 KB |
Output is correct |
95 |
Correct |
187 ms |
17228 KB |
Output is correct |
96 |
Correct |
179 ms |
17228 KB |
Output is correct |
97 |
Correct |
35 ms |
9688 KB |
Output is correct |
98 |
Correct |
35 ms |
9692 KB |
Output is correct |
99 |
Correct |
123 ms |
14788 KB |
Output is correct |
100 |
Correct |
175 ms |
17208 KB |
Output is correct |
101 |
Correct |
192 ms |
17224 KB |
Output is correct |
102 |
Correct |
36 ms |
9664 KB |
Output is correct |
103 |
Correct |
38 ms |
9672 KB |
Output is correct |
104 |
Correct |
5 ms |
8272 KB |
Output is correct |
105 |
Correct |
6 ms |
8272 KB |
Output is correct |
106 |
Correct |
5 ms |
8272 KB |
Output is correct |
107 |
Correct |
4 ms |
8144 KB |
Output is correct |
108 |
Correct |
4 ms |
8164 KB |
Output is correct |
109 |
Correct |
5 ms |
8272 KB |
Output is correct |
110 |
Correct |
5 ms |
8272 KB |
Output is correct |
111 |
Correct |
6 ms |
8272 KB |
Output is correct |
112 |
Correct |
4 ms |
8144 KB |
Output is correct |
113 |
Correct |
4 ms |
8144 KB |
Output is correct |
114 |
Correct |
755 ms |
9688 KB |
Output is correct |
115 |
Execution timed out |
4049 ms |
14788 KB |
Time limit exceeded |
116 |
Halted |
0 ms |
0 KB |
- |