#include <bits/stdc++.h>
using namespace std;
const int c=100005, sok=2e9+5;
int n, t[c], maxi, fixd;
bool tc1=1, fontos[c];
set<pair<int, int> > tc5;
set<int> pos;
set<pair<int, int> > dif;
int kul(int a, int b) {
return abs(t[a]-t[b]);
}
vector<vector<pair<int, int>>> rmq_mini, rmq_maxi;
vector<int> rmq_log;
void rmq_init(vector<int> sz) {
int n=sz.size();
rmq_log.resize(n+1);
for (int i=2; i<=n; i++) {
rmq_log[i]=rmq_log[i/2]+1;
}
int po=1, db=1;
while (po<=n) {
po*=2, db++;
}
rmq_mini.resize(db);
rmq_maxi.resize(db);
for (int i=0; i<db; i++) {
rmq_mini[i].resize(n);
rmq_maxi[i].resize(n);
}
for (int i=0; i<n; i++) {
rmq_mini[0][i]={sz[i], i};
rmq_maxi[0][i]={sz[i], i};
}
for (int j=1; j<db; j++) {
for (int i=0; i+(1<<j)<=n; i++) {
int s=i+(1<<(j-1));
rmq_mini[j][i]=min(rmq_mini[j-1][i], rmq_mini[j-1][s]);
rmq_maxi[j][i]=max(rmq_maxi[j-1][i], rmq_maxi[j-1][s]);
}
}
}
pair<int, int> rmq_ask(int l, int r, int id) {
int s=rmq_log[r-l+1], s2=r+1-(1<<s);
if (!id) {
return min(rmq_mini[s][l], rmq_mini[s][s2]);
} else {
return max(rmq_maxi[s][l], rmq_maxi[s][s2]);
}
}
vector<int> spec;
int try_tc46(int l, int r, int d) {
if (fixd!=0 && d!=fixd) return 0;
if (fixd==0) {
fixd=d;
int ut=sok, utid=0, id=1;
for (int i=1; i<=n+1; i++) {
if (id==1) {
if (t[i]>ut) utid=i;
ut=max(ut, t[i]);
if (ut-t[i]>=d) {
spec.push_back(utid);
utid=i;
ut=t[i];
id=0;
}
} else {
if (t[i]<ut) utid=i;
ut=min(ut, t[i]);
if (t[i]-ut>=d) {
spec.push_back(utid);
utid=i;
ut=t[i];
id=1;
}
}
}
spec.push_back(n+1);
/*cout<< "spec: ";
for (auto x:spec) cout << x << " ";
cout << "\n";*/
}
int kezd=-1, veg=-1;
int si=spec.size(), lo=0, hi=si, mid;
while (hi-lo>1) {
mid=(hi+lo)/2;
if (spec[mid]<l) lo=mid;
else hi=mid;
}
kezd=hi;
if (spec[kezd]>r) return 1;
lo=0, hi=si;
while (hi-lo>1) {
mid=(hi+lo)/2;
if (spec[mid]>r) hi=mid;
else lo=mid;
}
veg=lo;
//cout << "sikerult " << kezd << " " << veg << "\n";
assert(kezd<=veg);
int ans=(veg+1)/2-(kezd/2);
int kpos=spec[kezd], vpos=spec[veg];
if (l<kpos && kezd%2==0 && rmq_ask(l, kpos-1, 0).first+d<=t[kpos]) ans++;
if (vpos<r && veg%2==0 && rmq_ask(vpos+1, r, 0).first+d<=t[vpos]) ans++;
return ans;
}
void sub(int p) {
auto it=pos.find(p);
int el=0, kov=0;
it++;
kov=(*it);
it--, it--;
el=(*it);
//cout << "valt " << el << " " << p << " " << kov << "\n";
pos.erase(p);
dif.erase({kul(p, kov), p});
dif.erase({kul(el, p), el});
dif.insert({kul(el, kov), el});
}
void calc_tc5() {
fontos[0]=1, fontos[n+1]=1;
int ut=sok, ans=0, id=1;
for (int i=1; i<=n+1; i++) {
if (id==1) {
ut=max(ut, t[i]);
if (ut>t[i]) {
fontos[i-1]=1;
ut=t[i];
id=0;
ans++;
}
} else {
ut=min(ut, t[i]);
if (t[i]>ut) {
fontos[i-1]=1;
ut=t[i];
id=1;
}
}
}
int el=-1;
for (int i=0; i<=n+1; i++) {
if (!fontos[i]) continue;
pos.insert(i);
if (el!=-1) {
dif.insert({kul(el, i), el});
//cout << "fontos " << el << " " << i << "\n";
}
el=i;
}
tc5.insert({0, ans});
while (ans>1) {
auto it=dif.begin();
int ert=(*it).first, p=(*it).second;
auto it2=pos.upper_bound(p);
int kov=*it2;
//cout << "fontos " << p << " " << kov << "\n";
sub(p), sub(kov);
ans--;
//cout << ert << " " << ans << "\n";
it=tc5.upper_bound({ert, ans});
if (it!=tc5.end()) tc5.erase(it);
tc5.insert({ert, ans});
}
}
void init(int N, vector<int> sz) {
vector<int> sz2;
sz2.push_back(sok);
for (auto x:sz) sz2.push_back(x);
sz2.push_back(sok);
rmq_init(sz2);
n=N;
for (int i=0; i<n; i++) {
t[i+1]=sz[i];
if (t[i+1]>t[maxi]) maxi=i+1;
}
t[0]=sok, t[n+1]=sok;
for (int i=1; i<=n; i++) {
if (i<maxi && t[i]>t[i+1] || i>maxi && t[i]>t[i-1]) {
tc1=0;
}
}
calc_tc5();
}
int slow(int l, int r, int d) {
int ut=t[l]+d, ans=0, id=1;
for (int i=l; i<=r; i++) {
if (id==1) {
ut=max(ut, t[i]);
if (ut-t[i]>=d) {
ut=t[i];
id=0;
ans++;
}
} else {
ut=min(ut, t[i]);
if (t[i]-ut>=d) {
ut=t[i];
id=1;
}
}
}
return ans;
}
int max_towers(int l, int r, int d) {
l++, r++;
if (tc1) {
if (l<=maxi && maxi<=r && max(t[l], t[r])+d<=t[maxi]) return 2;
return 1;
}
if (l==1 && r==n) {
auto it=tc5.upper_bound({d, 0});
it--;
return (*it).second;
}
int x=try_tc46(l, r, d);
if (x) {
return x;
}
return slow(l, r, d);
}
Compilation message
towers.cpp: In function 'void init(int, std::vector<int>)':
towers.cpp:192:20: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
192 | if (i<maxi && t[i]>t[i+1] || i>maxi && t[i]>t[i-1]) {
| ~~~~~~~^~~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
256 ms |
17640 KB |
Output is correct |
2 |
Correct |
581 ms |
30764 KB |
Output is correct |
3 |
Correct |
574 ms |
30772 KB |
Output is correct |
4 |
Correct |
525 ms |
30808 KB |
Output is correct |
5 |
Correct |
567 ms |
30784 KB |
Output is correct |
6 |
Correct |
572 ms |
30788 KB |
Output is correct |
7 |
Correct |
544 ms |
30772 KB |
Output is correct |
8 |
Correct |
0 ms |
344 KB |
Output is correct |
9 |
Correct |
1 ms |
1112 KB |
Output is correct |
10 |
Correct |
1 ms |
856 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
2 ms |
856 KB |
Output is correct |
3 |
Correct |
2 ms |
856 KB |
Output is correct |
4 |
Correct |
3 ms |
856 KB |
Output is correct |
5 |
Correct |
2 ms |
856 KB |
Output is correct |
6 |
Correct |
2 ms |
1020 KB |
Output is correct |
7 |
Correct |
2 ms |
856 KB |
Output is correct |
8 |
Correct |
1 ms |
856 KB |
Output is correct |
9 |
Correct |
2 ms |
856 KB |
Output is correct |
10 |
Correct |
1 ms |
856 KB |
Output is correct |
11 |
Correct |
1 ms |
856 KB |
Output is correct |
12 |
Correct |
0 ms |
344 KB |
Output is correct |
13 |
Correct |
1 ms |
856 KB |
Output is correct |
14 |
Correct |
1 ms |
856 KB |
Output is correct |
15 |
Correct |
2 ms |
856 KB |
Output is correct |
16 |
Correct |
2 ms |
856 KB |
Output is correct |
17 |
Correct |
2 ms |
856 KB |
Output is correct |
18 |
Correct |
1 ms |
1112 KB |
Output is correct |
19 |
Correct |
1 ms |
856 KB |
Output is correct |
20 |
Correct |
2 ms |
856 KB |
Output is correct |
21 |
Correct |
2 ms |
856 KB |
Output is correct |
22 |
Correct |
2 ms |
856 KB |
Output is correct |
23 |
Correct |
1 ms |
856 KB |
Output is correct |
24 |
Correct |
1 ms |
856 KB |
Output is correct |
25 |
Correct |
1 ms |
600 KB |
Output is correct |
26 |
Correct |
2 ms |
856 KB |
Output is correct |
27 |
Correct |
2 ms |
856 KB |
Output is correct |
28 |
Correct |
2 ms |
856 KB |
Output is correct |
29 |
Correct |
2 ms |
856 KB |
Output is correct |
30 |
Correct |
3 ms |
1056 KB |
Output is correct |
31 |
Correct |
2 ms |
856 KB |
Output is correct |
32 |
Correct |
1 ms |
856 KB |
Output is correct |
33 |
Correct |
1 ms |
852 KB |
Output is correct |
34 |
Correct |
1 ms |
856 KB |
Output is correct |
35 |
Correct |
1 ms |
856 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
2 ms |
856 KB |
Output is correct |
3 |
Correct |
2 ms |
856 KB |
Output is correct |
4 |
Correct |
3 ms |
856 KB |
Output is correct |
5 |
Correct |
2 ms |
856 KB |
Output is correct |
6 |
Correct |
2 ms |
1020 KB |
Output is correct |
7 |
Correct |
2 ms |
856 KB |
Output is correct |
8 |
Correct |
1 ms |
856 KB |
Output is correct |
9 |
Correct |
2 ms |
856 KB |
Output is correct |
10 |
Correct |
1 ms |
856 KB |
Output is correct |
11 |
Correct |
1 ms |
856 KB |
Output is correct |
12 |
Correct |
0 ms |
344 KB |
Output is correct |
13 |
Correct |
1 ms |
856 KB |
Output is correct |
14 |
Correct |
1 ms |
856 KB |
Output is correct |
15 |
Correct |
2 ms |
856 KB |
Output is correct |
16 |
Correct |
2 ms |
856 KB |
Output is correct |
17 |
Correct |
2 ms |
856 KB |
Output is correct |
18 |
Correct |
1 ms |
1112 KB |
Output is correct |
19 |
Correct |
1 ms |
856 KB |
Output is correct |
20 |
Correct |
2 ms |
856 KB |
Output is correct |
21 |
Correct |
2 ms |
856 KB |
Output is correct |
22 |
Correct |
2 ms |
856 KB |
Output is correct |
23 |
Correct |
1 ms |
856 KB |
Output is correct |
24 |
Correct |
1 ms |
856 KB |
Output is correct |
25 |
Correct |
1 ms |
600 KB |
Output is correct |
26 |
Correct |
2 ms |
856 KB |
Output is correct |
27 |
Correct |
2 ms |
856 KB |
Output is correct |
28 |
Correct |
2 ms |
856 KB |
Output is correct |
29 |
Correct |
2 ms |
856 KB |
Output is correct |
30 |
Correct |
3 ms |
1056 KB |
Output is correct |
31 |
Correct |
2 ms |
856 KB |
Output is correct |
32 |
Correct |
1 ms |
856 KB |
Output is correct |
33 |
Correct |
1 ms |
852 KB |
Output is correct |
34 |
Correct |
1 ms |
856 KB |
Output is correct |
35 |
Correct |
1 ms |
856 KB |
Output is correct |
36 |
Correct |
68 ms |
23080 KB |
Output is correct |
37 |
Correct |
112 ms |
36820 KB |
Output is correct |
38 |
Correct |
110 ms |
36908 KB |
Output is correct |
39 |
Correct |
159 ms |
39984 KB |
Output is correct |
40 |
Correct |
189 ms |
40152 KB |
Output is correct |
41 |
Correct |
164 ms |
40076 KB |
Output is correct |
42 |
Correct |
167 ms |
40216 KB |
Output is correct |
43 |
Correct |
25 ms |
30788 KB |
Output is correct |
44 |
Correct |
26 ms |
30812 KB |
Output is correct |
45 |
Correct |
30 ms |
30776 KB |
Output is correct |
46 |
Correct |
24 ms |
30792 KB |
Output is correct |
47 |
Correct |
111 ms |
37016 KB |
Output is correct |
48 |
Correct |
162 ms |
40212 KB |
Output is correct |
49 |
Correct |
173 ms |
40208 KB |
Output is correct |
50 |
Correct |
24 ms |
30776 KB |
Output is correct |
51 |
Correct |
26 ms |
30808 KB |
Output is correct |
52 |
Correct |
109 ms |
36916 KB |
Output is correct |
53 |
Correct |
162 ms |
40244 KB |
Output is correct |
54 |
Correct |
161 ms |
39944 KB |
Output is correct |
55 |
Correct |
24 ms |
30772 KB |
Output is correct |
56 |
Correct |
28 ms |
30772 KB |
Output is correct |
57 |
Correct |
104 ms |
35600 KB |
Output is correct |
58 |
Correct |
113 ms |
36944 KB |
Output is correct |
59 |
Correct |
110 ms |
37068 KB |
Output is correct |
60 |
Correct |
158 ms |
39968 KB |
Output is correct |
61 |
Correct |
169 ms |
40220 KB |
Output is correct |
62 |
Correct |
162 ms |
40132 KB |
Output is correct |
63 |
Correct |
162 ms |
39980 KB |
Output is correct |
64 |
Correct |
25 ms |
30780 KB |
Output is correct |
65 |
Correct |
25 ms |
30784 KB |
Output is correct |
66 |
Correct |
24 ms |
30784 KB |
Output is correct |
67 |
Correct |
24 ms |
30728 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
554 ms |
36516 KB |
Output is correct |
2 |
Correct |
708 ms |
36916 KB |
Output is correct |
3 |
Correct |
711 ms |
36924 KB |
Output is correct |
4 |
Correct |
744 ms |
40216 KB |
Output is correct |
5 |
Correct |
756 ms |
40208 KB |
Output is correct |
6 |
Correct |
744 ms |
40232 KB |
Output is correct |
7 |
Correct |
711 ms |
40208 KB |
Output is correct |
8 |
Correct |
537 ms |
30792 KB |
Output is correct |
9 |
Correct |
524 ms |
30776 KB |
Output is correct |
10 |
Correct |
583 ms |
30788 KB |
Output is correct |
11 |
Correct |
547 ms |
30764 KB |
Output is correct |
12 |
Correct |
529 ms |
30748 KB |
Output is correct |
13 |
Correct |
512 ms |
30764 KB |
Output is correct |
14 |
Correct |
0 ms |
344 KB |
Output is correct |
15 |
Correct |
1 ms |
856 KB |
Output is correct |
16 |
Correct |
1 ms |
856 KB |
Output is correct |
17 |
Correct |
111 ms |
36832 KB |
Output is correct |
18 |
Correct |
186 ms |
40348 KB |
Output is correct |
19 |
Correct |
177 ms |
40260 KB |
Output is correct |
20 |
Correct |
27 ms |
30752 KB |
Output is correct |
21 |
Correct |
24 ms |
30792 KB |
Output is correct |
22 |
Correct |
108 ms |
37028 KB |
Output is correct |
23 |
Correct |
160 ms |
40156 KB |
Output is correct |
24 |
Correct |
155 ms |
39980 KB |
Output is correct |
25 |
Correct |
24 ms |
30784 KB |
Output is correct |
26 |
Correct |
29 ms |
30764 KB |
Output is correct |
27 |
Correct |
2 ms |
932 KB |
Output is correct |
28 |
Correct |
3 ms |
856 KB |
Output is correct |
29 |
Correct |
2 ms |
856 KB |
Output is correct |
30 |
Correct |
1 ms |
856 KB |
Output is correct |
31 |
Correct |
1 ms |
856 KB |
Output is correct |
32 |
Correct |
2 ms |
852 KB |
Output is correct |
33 |
Correct |
2 ms |
856 KB |
Output is correct |
34 |
Correct |
2 ms |
856 KB |
Output is correct |
35 |
Correct |
1 ms |
856 KB |
Output is correct |
36 |
Correct |
1 ms |
856 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
198 ms |
8464 KB |
Output is correct |
2 |
Correct |
713 ms |
37032 KB |
Output is correct |
3 |
Correct |
718 ms |
36916 KB |
Output is correct |
4 |
Correct |
783 ms |
39976 KB |
Output is correct |
5 |
Correct |
745 ms |
39980 KB |
Output is correct |
6 |
Correct |
730 ms |
39980 KB |
Output is correct |
7 |
Correct |
740 ms |
40132 KB |
Output is correct |
8 |
Correct |
596 ms |
30776 KB |
Output is correct |
9 |
Correct |
570 ms |
31176 KB |
Output is correct |
10 |
Correct |
582 ms |
30760 KB |
Output is correct |
11 |
Correct |
551 ms |
30768 KB |
Output is correct |
12 |
Correct |
106 ms |
36928 KB |
Output is correct |
13 |
Correct |
159 ms |
40156 KB |
Output is correct |
14 |
Correct |
166 ms |
40236 KB |
Output is correct |
15 |
Correct |
24 ms |
30832 KB |
Output is correct |
16 |
Correct |
24 ms |
30780 KB |
Output is correct |
17 |
Correct |
104 ms |
35532 KB |
Output is correct |
18 |
Correct |
113 ms |
37280 KB |
Output is correct |
19 |
Correct |
106 ms |
36928 KB |
Output is correct |
20 |
Correct |
158 ms |
39984 KB |
Output is correct |
21 |
Correct |
157 ms |
40160 KB |
Output is correct |
22 |
Correct |
161 ms |
39964 KB |
Output is correct |
23 |
Correct |
158 ms |
40032 KB |
Output is correct |
24 |
Correct |
24 ms |
30776 KB |
Output is correct |
25 |
Correct |
24 ms |
30812 KB |
Output is correct |
26 |
Correct |
26 ms |
30776 KB |
Output is correct |
27 |
Correct |
24 ms |
30708 KB |
Output is correct |
28 |
Correct |
2 ms |
856 KB |
Output is correct |
29 |
Correct |
2 ms |
856 KB |
Output is correct |
30 |
Correct |
2 ms |
856 KB |
Output is correct |
31 |
Correct |
1 ms |
856 KB |
Output is correct |
32 |
Correct |
1 ms |
856 KB |
Output is correct |
33 |
Correct |
1 ms |
600 KB |
Output is correct |
34 |
Correct |
2 ms |
856 KB |
Output is correct |
35 |
Correct |
2 ms |
856 KB |
Output is correct |
36 |
Correct |
2 ms |
856 KB |
Output is correct |
37 |
Correct |
2 ms |
856 KB |
Output is correct |
38 |
Correct |
3 ms |
856 KB |
Output is correct |
39 |
Correct |
2 ms |
856 KB |
Output is correct |
40 |
Correct |
1 ms |
856 KB |
Output is correct |
41 |
Correct |
1 ms |
856 KB |
Output is correct |
42 |
Correct |
1 ms |
856 KB |
Output is correct |
43 |
Correct |
1 ms |
856 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
2 ms |
856 KB |
Output is correct |
3 |
Correct |
2 ms |
856 KB |
Output is correct |
4 |
Correct |
3 ms |
856 KB |
Output is correct |
5 |
Correct |
2 ms |
856 KB |
Output is correct |
6 |
Correct |
2 ms |
1020 KB |
Output is correct |
7 |
Correct |
2 ms |
856 KB |
Output is correct |
8 |
Correct |
1 ms |
856 KB |
Output is correct |
9 |
Correct |
2 ms |
856 KB |
Output is correct |
10 |
Correct |
1 ms |
856 KB |
Output is correct |
11 |
Correct |
1 ms |
856 KB |
Output is correct |
12 |
Correct |
0 ms |
344 KB |
Output is correct |
13 |
Correct |
1 ms |
856 KB |
Output is correct |
14 |
Correct |
1 ms |
856 KB |
Output is correct |
15 |
Correct |
2 ms |
856 KB |
Output is correct |
16 |
Correct |
2 ms |
856 KB |
Output is correct |
17 |
Correct |
2 ms |
856 KB |
Output is correct |
18 |
Correct |
1 ms |
1112 KB |
Output is correct |
19 |
Correct |
1 ms |
856 KB |
Output is correct |
20 |
Correct |
2 ms |
856 KB |
Output is correct |
21 |
Correct |
2 ms |
856 KB |
Output is correct |
22 |
Correct |
2 ms |
856 KB |
Output is correct |
23 |
Correct |
1 ms |
856 KB |
Output is correct |
24 |
Correct |
1 ms |
856 KB |
Output is correct |
25 |
Correct |
1 ms |
600 KB |
Output is correct |
26 |
Correct |
2 ms |
856 KB |
Output is correct |
27 |
Correct |
2 ms |
856 KB |
Output is correct |
28 |
Correct |
2 ms |
856 KB |
Output is correct |
29 |
Correct |
2 ms |
856 KB |
Output is correct |
30 |
Correct |
3 ms |
1056 KB |
Output is correct |
31 |
Correct |
2 ms |
856 KB |
Output is correct |
32 |
Correct |
1 ms |
856 KB |
Output is correct |
33 |
Correct |
1 ms |
852 KB |
Output is correct |
34 |
Correct |
1 ms |
856 KB |
Output is correct |
35 |
Correct |
1 ms |
856 KB |
Output is correct |
36 |
Correct |
68 ms |
23080 KB |
Output is correct |
37 |
Correct |
112 ms |
36820 KB |
Output is correct |
38 |
Correct |
110 ms |
36908 KB |
Output is correct |
39 |
Correct |
159 ms |
39984 KB |
Output is correct |
40 |
Correct |
189 ms |
40152 KB |
Output is correct |
41 |
Correct |
164 ms |
40076 KB |
Output is correct |
42 |
Correct |
167 ms |
40216 KB |
Output is correct |
43 |
Correct |
25 ms |
30788 KB |
Output is correct |
44 |
Correct |
26 ms |
30812 KB |
Output is correct |
45 |
Correct |
30 ms |
30776 KB |
Output is correct |
46 |
Correct |
24 ms |
30792 KB |
Output is correct |
47 |
Correct |
111 ms |
37016 KB |
Output is correct |
48 |
Correct |
162 ms |
40212 KB |
Output is correct |
49 |
Correct |
173 ms |
40208 KB |
Output is correct |
50 |
Correct |
24 ms |
30776 KB |
Output is correct |
51 |
Correct |
26 ms |
30808 KB |
Output is correct |
52 |
Correct |
109 ms |
36916 KB |
Output is correct |
53 |
Correct |
162 ms |
40244 KB |
Output is correct |
54 |
Correct |
161 ms |
39944 KB |
Output is correct |
55 |
Correct |
24 ms |
30772 KB |
Output is correct |
56 |
Correct |
28 ms |
30772 KB |
Output is correct |
57 |
Correct |
104 ms |
35600 KB |
Output is correct |
58 |
Correct |
113 ms |
36944 KB |
Output is correct |
59 |
Correct |
110 ms |
37068 KB |
Output is correct |
60 |
Correct |
158 ms |
39968 KB |
Output is correct |
61 |
Correct |
169 ms |
40220 KB |
Output is correct |
62 |
Correct |
162 ms |
40132 KB |
Output is correct |
63 |
Correct |
162 ms |
39980 KB |
Output is correct |
64 |
Correct |
25 ms |
30780 KB |
Output is correct |
65 |
Correct |
25 ms |
30784 KB |
Output is correct |
66 |
Correct |
24 ms |
30784 KB |
Output is correct |
67 |
Correct |
24 ms |
30728 KB |
Output is correct |
68 |
Correct |
554 ms |
36516 KB |
Output is correct |
69 |
Correct |
708 ms |
36916 KB |
Output is correct |
70 |
Correct |
711 ms |
36924 KB |
Output is correct |
71 |
Correct |
744 ms |
40216 KB |
Output is correct |
72 |
Correct |
756 ms |
40208 KB |
Output is correct |
73 |
Correct |
744 ms |
40232 KB |
Output is correct |
74 |
Correct |
711 ms |
40208 KB |
Output is correct |
75 |
Correct |
537 ms |
30792 KB |
Output is correct |
76 |
Correct |
524 ms |
30776 KB |
Output is correct |
77 |
Correct |
583 ms |
30788 KB |
Output is correct |
78 |
Correct |
547 ms |
30764 KB |
Output is correct |
79 |
Correct |
529 ms |
30748 KB |
Output is correct |
80 |
Correct |
512 ms |
30764 KB |
Output is correct |
81 |
Correct |
0 ms |
344 KB |
Output is correct |
82 |
Correct |
1 ms |
856 KB |
Output is correct |
83 |
Correct |
1 ms |
856 KB |
Output is correct |
84 |
Correct |
111 ms |
36832 KB |
Output is correct |
85 |
Correct |
186 ms |
40348 KB |
Output is correct |
86 |
Correct |
177 ms |
40260 KB |
Output is correct |
87 |
Correct |
27 ms |
30752 KB |
Output is correct |
88 |
Correct |
24 ms |
30792 KB |
Output is correct |
89 |
Correct |
108 ms |
37028 KB |
Output is correct |
90 |
Correct |
160 ms |
40156 KB |
Output is correct |
91 |
Correct |
155 ms |
39980 KB |
Output is correct |
92 |
Correct |
24 ms |
30784 KB |
Output is correct |
93 |
Correct |
29 ms |
30764 KB |
Output is correct |
94 |
Correct |
2 ms |
932 KB |
Output is correct |
95 |
Correct |
3 ms |
856 KB |
Output is correct |
96 |
Correct |
2 ms |
856 KB |
Output is correct |
97 |
Correct |
1 ms |
856 KB |
Output is correct |
98 |
Correct |
1 ms |
856 KB |
Output is correct |
99 |
Correct |
2 ms |
852 KB |
Output is correct |
100 |
Correct |
2 ms |
856 KB |
Output is correct |
101 |
Correct |
2 ms |
856 KB |
Output is correct |
102 |
Correct |
1 ms |
856 KB |
Output is correct |
103 |
Correct |
1 ms |
856 KB |
Output is correct |
104 |
Correct |
583 ms |
32928 KB |
Output is correct |
105 |
Correct |
727 ms |
37024 KB |
Output is correct |
106 |
Correct |
723 ms |
36908 KB |
Output is correct |
107 |
Correct |
733 ms |
39972 KB |
Output is correct |
108 |
Correct |
727 ms |
40476 KB |
Output is correct |
109 |
Correct |
798 ms |
40160 KB |
Output is correct |
110 |
Correct |
737 ms |
40156 KB |
Output is correct |
111 |
Correct |
532 ms |
30792 KB |
Output is correct |
112 |
Correct |
564 ms |
30772 KB |
Output is correct |
113 |
Correct |
649 ms |
30792 KB |
Output is correct |
114 |
Correct |
614 ms |
30780 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
256 ms |
17640 KB |
Output is correct |
2 |
Correct |
581 ms |
30764 KB |
Output is correct |
3 |
Correct |
574 ms |
30772 KB |
Output is correct |
4 |
Correct |
525 ms |
30808 KB |
Output is correct |
5 |
Correct |
567 ms |
30784 KB |
Output is correct |
6 |
Correct |
572 ms |
30788 KB |
Output is correct |
7 |
Correct |
544 ms |
30772 KB |
Output is correct |
8 |
Correct |
0 ms |
344 KB |
Output is correct |
9 |
Correct |
1 ms |
1112 KB |
Output is correct |
10 |
Correct |
1 ms |
856 KB |
Output is correct |
11 |
Correct |
1 ms |
344 KB |
Output is correct |
12 |
Correct |
2 ms |
856 KB |
Output is correct |
13 |
Correct |
2 ms |
856 KB |
Output is correct |
14 |
Correct |
3 ms |
856 KB |
Output is correct |
15 |
Correct |
2 ms |
856 KB |
Output is correct |
16 |
Correct |
2 ms |
1020 KB |
Output is correct |
17 |
Correct |
2 ms |
856 KB |
Output is correct |
18 |
Correct |
1 ms |
856 KB |
Output is correct |
19 |
Correct |
2 ms |
856 KB |
Output is correct |
20 |
Correct |
1 ms |
856 KB |
Output is correct |
21 |
Correct |
1 ms |
856 KB |
Output is correct |
22 |
Correct |
0 ms |
344 KB |
Output is correct |
23 |
Correct |
1 ms |
856 KB |
Output is correct |
24 |
Correct |
1 ms |
856 KB |
Output is correct |
25 |
Correct |
2 ms |
856 KB |
Output is correct |
26 |
Correct |
2 ms |
856 KB |
Output is correct |
27 |
Correct |
2 ms |
856 KB |
Output is correct |
28 |
Correct |
1 ms |
1112 KB |
Output is correct |
29 |
Correct |
1 ms |
856 KB |
Output is correct |
30 |
Correct |
2 ms |
856 KB |
Output is correct |
31 |
Correct |
2 ms |
856 KB |
Output is correct |
32 |
Correct |
2 ms |
856 KB |
Output is correct |
33 |
Correct |
1 ms |
856 KB |
Output is correct |
34 |
Correct |
1 ms |
856 KB |
Output is correct |
35 |
Correct |
1 ms |
600 KB |
Output is correct |
36 |
Correct |
2 ms |
856 KB |
Output is correct |
37 |
Correct |
2 ms |
856 KB |
Output is correct |
38 |
Correct |
2 ms |
856 KB |
Output is correct |
39 |
Correct |
2 ms |
856 KB |
Output is correct |
40 |
Correct |
3 ms |
1056 KB |
Output is correct |
41 |
Correct |
2 ms |
856 KB |
Output is correct |
42 |
Correct |
1 ms |
856 KB |
Output is correct |
43 |
Correct |
1 ms |
852 KB |
Output is correct |
44 |
Correct |
1 ms |
856 KB |
Output is correct |
45 |
Correct |
1 ms |
856 KB |
Output is correct |
46 |
Correct |
68 ms |
23080 KB |
Output is correct |
47 |
Correct |
112 ms |
36820 KB |
Output is correct |
48 |
Correct |
110 ms |
36908 KB |
Output is correct |
49 |
Correct |
159 ms |
39984 KB |
Output is correct |
50 |
Correct |
189 ms |
40152 KB |
Output is correct |
51 |
Correct |
164 ms |
40076 KB |
Output is correct |
52 |
Correct |
167 ms |
40216 KB |
Output is correct |
53 |
Correct |
25 ms |
30788 KB |
Output is correct |
54 |
Correct |
26 ms |
30812 KB |
Output is correct |
55 |
Correct |
30 ms |
30776 KB |
Output is correct |
56 |
Correct |
24 ms |
30792 KB |
Output is correct |
57 |
Correct |
111 ms |
37016 KB |
Output is correct |
58 |
Correct |
162 ms |
40212 KB |
Output is correct |
59 |
Correct |
173 ms |
40208 KB |
Output is correct |
60 |
Correct |
24 ms |
30776 KB |
Output is correct |
61 |
Correct |
26 ms |
30808 KB |
Output is correct |
62 |
Correct |
109 ms |
36916 KB |
Output is correct |
63 |
Correct |
162 ms |
40244 KB |
Output is correct |
64 |
Correct |
161 ms |
39944 KB |
Output is correct |
65 |
Correct |
24 ms |
30772 KB |
Output is correct |
66 |
Correct |
28 ms |
30772 KB |
Output is correct |
67 |
Correct |
104 ms |
35600 KB |
Output is correct |
68 |
Correct |
113 ms |
36944 KB |
Output is correct |
69 |
Correct |
110 ms |
37068 KB |
Output is correct |
70 |
Correct |
158 ms |
39968 KB |
Output is correct |
71 |
Correct |
169 ms |
40220 KB |
Output is correct |
72 |
Correct |
162 ms |
40132 KB |
Output is correct |
73 |
Correct |
162 ms |
39980 KB |
Output is correct |
74 |
Correct |
25 ms |
30780 KB |
Output is correct |
75 |
Correct |
25 ms |
30784 KB |
Output is correct |
76 |
Correct |
24 ms |
30784 KB |
Output is correct |
77 |
Correct |
24 ms |
30728 KB |
Output is correct |
78 |
Correct |
554 ms |
36516 KB |
Output is correct |
79 |
Correct |
708 ms |
36916 KB |
Output is correct |
80 |
Correct |
711 ms |
36924 KB |
Output is correct |
81 |
Correct |
744 ms |
40216 KB |
Output is correct |
82 |
Correct |
756 ms |
40208 KB |
Output is correct |
83 |
Correct |
744 ms |
40232 KB |
Output is correct |
84 |
Correct |
711 ms |
40208 KB |
Output is correct |
85 |
Correct |
537 ms |
30792 KB |
Output is correct |
86 |
Correct |
524 ms |
30776 KB |
Output is correct |
87 |
Correct |
583 ms |
30788 KB |
Output is correct |
88 |
Correct |
547 ms |
30764 KB |
Output is correct |
89 |
Correct |
529 ms |
30748 KB |
Output is correct |
90 |
Correct |
512 ms |
30764 KB |
Output is correct |
91 |
Correct |
0 ms |
344 KB |
Output is correct |
92 |
Correct |
1 ms |
856 KB |
Output is correct |
93 |
Correct |
1 ms |
856 KB |
Output is correct |
94 |
Correct |
111 ms |
36832 KB |
Output is correct |
95 |
Correct |
186 ms |
40348 KB |
Output is correct |
96 |
Correct |
177 ms |
40260 KB |
Output is correct |
97 |
Correct |
27 ms |
30752 KB |
Output is correct |
98 |
Correct |
24 ms |
30792 KB |
Output is correct |
99 |
Correct |
108 ms |
37028 KB |
Output is correct |
100 |
Correct |
160 ms |
40156 KB |
Output is correct |
101 |
Correct |
155 ms |
39980 KB |
Output is correct |
102 |
Correct |
24 ms |
30784 KB |
Output is correct |
103 |
Correct |
29 ms |
30764 KB |
Output is correct |
104 |
Correct |
2 ms |
932 KB |
Output is correct |
105 |
Correct |
3 ms |
856 KB |
Output is correct |
106 |
Correct |
2 ms |
856 KB |
Output is correct |
107 |
Correct |
1 ms |
856 KB |
Output is correct |
108 |
Correct |
1 ms |
856 KB |
Output is correct |
109 |
Correct |
2 ms |
852 KB |
Output is correct |
110 |
Correct |
2 ms |
856 KB |
Output is correct |
111 |
Correct |
2 ms |
856 KB |
Output is correct |
112 |
Correct |
1 ms |
856 KB |
Output is correct |
113 |
Correct |
1 ms |
856 KB |
Output is correct |
114 |
Correct |
198 ms |
8464 KB |
Output is correct |
115 |
Correct |
713 ms |
37032 KB |
Output is correct |
116 |
Correct |
718 ms |
36916 KB |
Output is correct |
117 |
Correct |
783 ms |
39976 KB |
Output is correct |
118 |
Correct |
745 ms |
39980 KB |
Output is correct |
119 |
Correct |
730 ms |
39980 KB |
Output is correct |
120 |
Correct |
740 ms |
40132 KB |
Output is correct |
121 |
Correct |
596 ms |
30776 KB |
Output is correct |
122 |
Correct |
570 ms |
31176 KB |
Output is correct |
123 |
Correct |
582 ms |
30760 KB |
Output is correct |
124 |
Correct |
551 ms |
30768 KB |
Output is correct |
125 |
Correct |
106 ms |
36928 KB |
Output is correct |
126 |
Correct |
159 ms |
40156 KB |
Output is correct |
127 |
Correct |
166 ms |
40236 KB |
Output is correct |
128 |
Correct |
24 ms |
30832 KB |
Output is correct |
129 |
Correct |
24 ms |
30780 KB |
Output is correct |
130 |
Correct |
104 ms |
35532 KB |
Output is correct |
131 |
Correct |
113 ms |
37280 KB |
Output is correct |
132 |
Correct |
106 ms |
36928 KB |
Output is correct |
133 |
Correct |
158 ms |
39984 KB |
Output is correct |
134 |
Correct |
157 ms |
40160 KB |
Output is correct |
135 |
Correct |
161 ms |
39964 KB |
Output is correct |
136 |
Correct |
158 ms |
40032 KB |
Output is correct |
137 |
Correct |
24 ms |
30776 KB |
Output is correct |
138 |
Correct |
24 ms |
30812 KB |
Output is correct |
139 |
Correct |
26 ms |
30776 KB |
Output is correct |
140 |
Correct |
24 ms |
30708 KB |
Output is correct |
141 |
Correct |
2 ms |
856 KB |
Output is correct |
142 |
Correct |
2 ms |
856 KB |
Output is correct |
143 |
Correct |
2 ms |
856 KB |
Output is correct |
144 |
Correct |
1 ms |
856 KB |
Output is correct |
145 |
Correct |
1 ms |
856 KB |
Output is correct |
146 |
Correct |
1 ms |
600 KB |
Output is correct |
147 |
Correct |
2 ms |
856 KB |
Output is correct |
148 |
Correct |
2 ms |
856 KB |
Output is correct |
149 |
Correct |
2 ms |
856 KB |
Output is correct |
150 |
Correct |
2 ms |
856 KB |
Output is correct |
151 |
Correct |
3 ms |
856 KB |
Output is correct |
152 |
Correct |
2 ms |
856 KB |
Output is correct |
153 |
Correct |
1 ms |
856 KB |
Output is correct |
154 |
Correct |
1 ms |
856 KB |
Output is correct |
155 |
Correct |
1 ms |
856 KB |
Output is correct |
156 |
Correct |
1 ms |
856 KB |
Output is correct |
157 |
Correct |
583 ms |
32928 KB |
Output is correct |
158 |
Correct |
727 ms |
37024 KB |
Output is correct |
159 |
Correct |
723 ms |
36908 KB |
Output is correct |
160 |
Correct |
733 ms |
39972 KB |
Output is correct |
161 |
Correct |
727 ms |
40476 KB |
Output is correct |
162 |
Correct |
798 ms |
40160 KB |
Output is correct |
163 |
Correct |
737 ms |
40156 KB |
Output is correct |
164 |
Correct |
532 ms |
30792 KB |
Output is correct |
165 |
Correct |
564 ms |
30772 KB |
Output is correct |
166 |
Correct |
649 ms |
30792 KB |
Output is correct |
167 |
Correct |
614 ms |
30780 KB |
Output is correct |
168 |
Correct |
0 ms |
344 KB |
Output is correct |
169 |
Correct |
3292 ms |
12416 KB |
Output is correct |
170 |
Execution timed out |
4016 ms |
36996 KB |
Time limit exceeded |
171 |
Halted |
0 ms |
0 KB |
- |