#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);
}
/*
int main()
{
int N;
vector<int> P;
cin >> N;
for (int i=0; i<N; i++) {
int x;
cin >> x;
P.push_back(x);
}
init(N, P);
int q;
cin >> q;
while (q--) {
int l, r, d;
cin >> l >> r >> d;
cout << max_towers(l, r, d) << "\n";
}
return 0;
}
*/
/*
5
1 5 3 4 2
10
0 2 2
*/
/*
7
1 2 6 4 5 3 7
*/
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 |
306 ms |
17556 KB |
Output is correct |
2 |
Correct |
870 ms |
30664 KB |
Output is correct |
3 |
Correct |
700 ms |
30644 KB |
Output is correct |
4 |
Correct |
646 ms |
30640 KB |
Output is correct |
5 |
Correct |
809 ms |
30656 KB |
Output is correct |
6 |
Correct |
817 ms |
30656 KB |
Output is correct |
7 |
Correct |
728 ms |
30652 KB |
Output is correct |
8 |
Correct |
0 ms |
208 KB |
Output is correct |
9 |
Correct |
1 ms |
720 KB |
Output is correct |
10 |
Correct |
1 ms |
720 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
2 ms |
720 KB |
Output is correct |
3 |
Correct |
3 ms |
848 KB |
Output is correct |
4 |
Correct |
3 ms |
908 KB |
Output is correct |
5 |
Correct |
3 ms |
848 KB |
Output is correct |
6 |
Correct |
3 ms |
848 KB |
Output is correct |
7 |
Correct |
2 ms |
848 KB |
Output is correct |
8 |
Correct |
1 ms |
720 KB |
Output is correct |
9 |
Correct |
1 ms |
720 KB |
Output is correct |
10 |
Correct |
1 ms |
720 KB |
Output is correct |
11 |
Correct |
1 ms |
736 KB |
Output is correct |
12 |
Correct |
0 ms |
208 KB |
Output is correct |
13 |
Correct |
1 ms |
720 KB |
Output is correct |
14 |
Correct |
1 ms |
720 KB |
Output is correct |
15 |
Correct |
2 ms |
844 KB |
Output is correct |
16 |
Correct |
3 ms |
848 KB |
Output is correct |
17 |
Correct |
3 ms |
848 KB |
Output is correct |
18 |
Correct |
1 ms |
720 KB |
Output is correct |
19 |
Correct |
1 ms |
720 KB |
Output is correct |
20 |
Correct |
2 ms |
848 KB |
Output is correct |
21 |
Correct |
3 ms |
848 KB |
Output is correct |
22 |
Correct |
4 ms |
908 KB |
Output is correct |
23 |
Correct |
1 ms |
720 KB |
Output is correct |
24 |
Correct |
1 ms |
720 KB |
Output is correct |
25 |
Correct |
1 ms |
464 KB |
Output is correct |
26 |
Correct |
2 ms |
848 KB |
Output is correct |
27 |
Correct |
2 ms |
848 KB |
Output is correct |
28 |
Correct |
3 ms |
856 KB |
Output is correct |
29 |
Correct |
3 ms |
848 KB |
Output is correct |
30 |
Correct |
3 ms |
848 KB |
Output is correct |
31 |
Correct |
3 ms |
848 KB |
Output is correct |
32 |
Correct |
1 ms |
720 KB |
Output is correct |
33 |
Correct |
1 ms |
720 KB |
Output is correct |
34 |
Correct |
1 ms |
720 KB |
Output is correct |
35 |
Correct |
1 ms |
720 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
2 ms |
720 KB |
Output is correct |
3 |
Correct |
3 ms |
848 KB |
Output is correct |
4 |
Correct |
3 ms |
908 KB |
Output is correct |
5 |
Correct |
3 ms |
848 KB |
Output is correct |
6 |
Correct |
3 ms |
848 KB |
Output is correct |
7 |
Correct |
2 ms |
848 KB |
Output is correct |
8 |
Correct |
1 ms |
720 KB |
Output is correct |
9 |
Correct |
1 ms |
720 KB |
Output is correct |
10 |
Correct |
1 ms |
720 KB |
Output is correct |
11 |
Correct |
1 ms |
736 KB |
Output is correct |
12 |
Correct |
0 ms |
208 KB |
Output is correct |
13 |
Correct |
1 ms |
720 KB |
Output is correct |
14 |
Correct |
1 ms |
720 KB |
Output is correct |
15 |
Correct |
2 ms |
844 KB |
Output is correct |
16 |
Correct |
3 ms |
848 KB |
Output is correct |
17 |
Correct |
3 ms |
848 KB |
Output is correct |
18 |
Correct |
1 ms |
720 KB |
Output is correct |
19 |
Correct |
1 ms |
720 KB |
Output is correct |
20 |
Correct |
2 ms |
848 KB |
Output is correct |
21 |
Correct |
3 ms |
848 KB |
Output is correct |
22 |
Correct |
4 ms |
908 KB |
Output is correct |
23 |
Correct |
1 ms |
720 KB |
Output is correct |
24 |
Correct |
1 ms |
720 KB |
Output is correct |
25 |
Correct |
1 ms |
464 KB |
Output is correct |
26 |
Correct |
2 ms |
848 KB |
Output is correct |
27 |
Correct |
2 ms |
848 KB |
Output is correct |
28 |
Correct |
3 ms |
856 KB |
Output is correct |
29 |
Correct |
3 ms |
848 KB |
Output is correct |
30 |
Correct |
3 ms |
848 KB |
Output is correct |
31 |
Correct |
3 ms |
848 KB |
Output is correct |
32 |
Correct |
1 ms |
720 KB |
Output is correct |
33 |
Correct |
1 ms |
720 KB |
Output is correct |
34 |
Correct |
1 ms |
720 KB |
Output is correct |
35 |
Correct |
1 ms |
720 KB |
Output is correct |
36 |
Correct |
88 ms |
23060 KB |
Output is correct |
37 |
Correct |
141 ms |
36812 KB |
Output is correct |
38 |
Correct |
140 ms |
36876 KB |
Output is correct |
39 |
Correct |
233 ms |
40020 KB |
Output is correct |
40 |
Correct |
224 ms |
40072 KB |
Output is correct |
41 |
Correct |
226 ms |
40020 KB |
Output is correct |
42 |
Correct |
230 ms |
40104 KB |
Output is correct |
43 |
Correct |
32 ms |
30640 KB |
Output is correct |
44 |
Correct |
28 ms |
30636 KB |
Output is correct |
45 |
Correct |
28 ms |
30620 KB |
Output is correct |
46 |
Correct |
27 ms |
30616 KB |
Output is correct |
47 |
Correct |
160 ms |
36872 KB |
Output is correct |
48 |
Correct |
222 ms |
40068 KB |
Output is correct |
49 |
Correct |
216 ms |
40028 KB |
Output is correct |
50 |
Correct |
34 ms |
30656 KB |
Output is correct |
51 |
Correct |
28 ms |
30620 KB |
Output is correct |
52 |
Correct |
133 ms |
36760 KB |
Output is correct |
53 |
Correct |
222 ms |
40016 KB |
Output is correct |
54 |
Correct |
213 ms |
39972 KB |
Output is correct |
55 |
Correct |
27 ms |
30620 KB |
Output is correct |
56 |
Correct |
29 ms |
30660 KB |
Output is correct |
57 |
Correct |
137 ms |
35620 KB |
Output is correct |
58 |
Correct |
135 ms |
36828 KB |
Output is correct |
59 |
Correct |
144 ms |
36904 KB |
Output is correct |
60 |
Correct |
211 ms |
39960 KB |
Output is correct |
61 |
Correct |
211 ms |
39956 KB |
Output is correct |
62 |
Correct |
212 ms |
39956 KB |
Output is correct |
63 |
Correct |
225 ms |
40016 KB |
Output is correct |
64 |
Correct |
27 ms |
30620 KB |
Output is correct |
65 |
Correct |
27 ms |
30584 KB |
Output is correct |
66 |
Correct |
28 ms |
30600 KB |
Output is correct |
67 |
Correct |
27 ms |
30616 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
807 ms |
36524 KB |
Output is correct |
2 |
Correct |
1002 ms |
36792 KB |
Output is correct |
3 |
Correct |
998 ms |
36880 KB |
Output is correct |
4 |
Correct |
1095 ms |
40112 KB |
Output is correct |
5 |
Correct |
1092 ms |
40104 KB |
Output is correct |
6 |
Correct |
1081 ms |
40132 KB |
Output is correct |
7 |
Correct |
890 ms |
40104 KB |
Output is correct |
8 |
Correct |
847 ms |
30636 KB |
Output is correct |
9 |
Correct |
726 ms |
30748 KB |
Output is correct |
10 |
Correct |
897 ms |
30632 KB |
Output is correct |
11 |
Correct |
723 ms |
30628 KB |
Output is correct |
12 |
Correct |
861 ms |
30572 KB |
Output is correct |
13 |
Correct |
804 ms |
30656 KB |
Output is correct |
14 |
Correct |
0 ms |
208 KB |
Output is correct |
15 |
Correct |
1 ms |
720 KB |
Output is correct |
16 |
Correct |
1 ms |
720 KB |
Output is correct |
17 |
Correct |
139 ms |
36764 KB |
Output is correct |
18 |
Correct |
225 ms |
40104 KB |
Output is correct |
19 |
Correct |
238 ms |
40104 KB |
Output is correct |
20 |
Correct |
28 ms |
30604 KB |
Output is correct |
21 |
Correct |
28 ms |
30676 KB |
Output is correct |
22 |
Correct |
149 ms |
36792 KB |
Output is correct |
23 |
Correct |
219 ms |
40084 KB |
Output is correct |
24 |
Correct |
212 ms |
40024 KB |
Output is correct |
25 |
Correct |
29 ms |
30608 KB |
Output is correct |
26 |
Correct |
34 ms |
30668 KB |
Output is correct |
27 |
Correct |
2 ms |
720 KB |
Output is correct |
28 |
Correct |
3 ms |
848 KB |
Output is correct |
29 |
Correct |
2 ms |
848 KB |
Output is correct |
30 |
Correct |
1 ms |
720 KB |
Output is correct |
31 |
Correct |
1 ms |
720 KB |
Output is correct |
32 |
Correct |
2 ms |
720 KB |
Output is correct |
33 |
Correct |
2 ms |
848 KB |
Output is correct |
34 |
Correct |
3 ms |
848 KB |
Output is correct |
35 |
Correct |
1 ms |
720 KB |
Output is correct |
36 |
Correct |
1 ms |
720 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
253 ms |
8296 KB |
Output is correct |
2 |
Correct |
879 ms |
36776 KB |
Output is correct |
3 |
Correct |
1012 ms |
36796 KB |
Output is correct |
4 |
Correct |
1115 ms |
40016 KB |
Output is correct |
5 |
Correct |
962 ms |
39992 KB |
Output is correct |
6 |
Correct |
1163 ms |
39976 KB |
Output is correct |
7 |
Correct |
1113 ms |
39960 KB |
Output is correct |
8 |
Correct |
721 ms |
30632 KB |
Output is correct |
9 |
Correct |
857 ms |
30656 KB |
Output is correct |
10 |
Correct |
859 ms |
30640 KB |
Output is correct |
11 |
Correct |
675 ms |
30664 KB |
Output is correct |
12 |
Correct |
143 ms |
36792 KB |
Output is correct |
13 |
Correct |
213 ms |
40024 KB |
Output is correct |
14 |
Correct |
223 ms |
39964 KB |
Output is correct |
15 |
Correct |
28 ms |
30664 KB |
Output is correct |
16 |
Correct |
29 ms |
30628 KB |
Output is correct |
17 |
Correct |
128 ms |
35624 KB |
Output is correct |
18 |
Correct |
150 ms |
37024 KB |
Output is correct |
19 |
Correct |
142 ms |
36880 KB |
Output is correct |
20 |
Correct |
211 ms |
40020 KB |
Output is correct |
21 |
Correct |
224 ms |
39956 KB |
Output is correct |
22 |
Correct |
231 ms |
40024 KB |
Output is correct |
23 |
Correct |
221 ms |
40016 KB |
Output is correct |
24 |
Correct |
28 ms |
30620 KB |
Output is correct |
25 |
Correct |
31 ms |
30628 KB |
Output is correct |
26 |
Correct |
28 ms |
30660 KB |
Output is correct |
27 |
Correct |
36 ms |
30616 KB |
Output is correct |
28 |
Correct |
2 ms |
848 KB |
Output is correct |
29 |
Correct |
3 ms |
848 KB |
Output is correct |
30 |
Correct |
3 ms |
848 KB |
Output is correct |
31 |
Correct |
1 ms |
720 KB |
Output is correct |
32 |
Correct |
1 ms |
720 KB |
Output is correct |
33 |
Correct |
1 ms |
464 KB |
Output is correct |
34 |
Correct |
2 ms |
848 KB |
Output is correct |
35 |
Correct |
2 ms |
720 KB |
Output is correct |
36 |
Correct |
3 ms |
848 KB |
Output is correct |
37 |
Correct |
2 ms |
848 KB |
Output is correct |
38 |
Correct |
3 ms |
848 KB |
Output is correct |
39 |
Correct |
3 ms |
848 KB |
Output is correct |
40 |
Correct |
1 ms |
720 KB |
Output is correct |
41 |
Correct |
1 ms |
720 KB |
Output is correct |
42 |
Correct |
1 ms |
720 KB |
Output is correct |
43 |
Correct |
1 ms |
720 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
2 ms |
720 KB |
Output is correct |
3 |
Correct |
3 ms |
848 KB |
Output is correct |
4 |
Correct |
3 ms |
908 KB |
Output is correct |
5 |
Correct |
3 ms |
848 KB |
Output is correct |
6 |
Correct |
3 ms |
848 KB |
Output is correct |
7 |
Correct |
2 ms |
848 KB |
Output is correct |
8 |
Correct |
1 ms |
720 KB |
Output is correct |
9 |
Correct |
1 ms |
720 KB |
Output is correct |
10 |
Correct |
1 ms |
720 KB |
Output is correct |
11 |
Correct |
1 ms |
736 KB |
Output is correct |
12 |
Correct |
0 ms |
208 KB |
Output is correct |
13 |
Correct |
1 ms |
720 KB |
Output is correct |
14 |
Correct |
1 ms |
720 KB |
Output is correct |
15 |
Correct |
2 ms |
844 KB |
Output is correct |
16 |
Correct |
3 ms |
848 KB |
Output is correct |
17 |
Correct |
3 ms |
848 KB |
Output is correct |
18 |
Correct |
1 ms |
720 KB |
Output is correct |
19 |
Correct |
1 ms |
720 KB |
Output is correct |
20 |
Correct |
2 ms |
848 KB |
Output is correct |
21 |
Correct |
3 ms |
848 KB |
Output is correct |
22 |
Correct |
4 ms |
908 KB |
Output is correct |
23 |
Correct |
1 ms |
720 KB |
Output is correct |
24 |
Correct |
1 ms |
720 KB |
Output is correct |
25 |
Correct |
1 ms |
464 KB |
Output is correct |
26 |
Correct |
2 ms |
848 KB |
Output is correct |
27 |
Correct |
2 ms |
848 KB |
Output is correct |
28 |
Correct |
3 ms |
856 KB |
Output is correct |
29 |
Correct |
3 ms |
848 KB |
Output is correct |
30 |
Correct |
3 ms |
848 KB |
Output is correct |
31 |
Correct |
3 ms |
848 KB |
Output is correct |
32 |
Correct |
1 ms |
720 KB |
Output is correct |
33 |
Correct |
1 ms |
720 KB |
Output is correct |
34 |
Correct |
1 ms |
720 KB |
Output is correct |
35 |
Correct |
1 ms |
720 KB |
Output is correct |
36 |
Correct |
88 ms |
23060 KB |
Output is correct |
37 |
Correct |
141 ms |
36812 KB |
Output is correct |
38 |
Correct |
140 ms |
36876 KB |
Output is correct |
39 |
Correct |
233 ms |
40020 KB |
Output is correct |
40 |
Correct |
224 ms |
40072 KB |
Output is correct |
41 |
Correct |
226 ms |
40020 KB |
Output is correct |
42 |
Correct |
230 ms |
40104 KB |
Output is correct |
43 |
Correct |
32 ms |
30640 KB |
Output is correct |
44 |
Correct |
28 ms |
30636 KB |
Output is correct |
45 |
Correct |
28 ms |
30620 KB |
Output is correct |
46 |
Correct |
27 ms |
30616 KB |
Output is correct |
47 |
Correct |
160 ms |
36872 KB |
Output is correct |
48 |
Correct |
222 ms |
40068 KB |
Output is correct |
49 |
Correct |
216 ms |
40028 KB |
Output is correct |
50 |
Correct |
34 ms |
30656 KB |
Output is correct |
51 |
Correct |
28 ms |
30620 KB |
Output is correct |
52 |
Correct |
133 ms |
36760 KB |
Output is correct |
53 |
Correct |
222 ms |
40016 KB |
Output is correct |
54 |
Correct |
213 ms |
39972 KB |
Output is correct |
55 |
Correct |
27 ms |
30620 KB |
Output is correct |
56 |
Correct |
29 ms |
30660 KB |
Output is correct |
57 |
Correct |
137 ms |
35620 KB |
Output is correct |
58 |
Correct |
135 ms |
36828 KB |
Output is correct |
59 |
Correct |
144 ms |
36904 KB |
Output is correct |
60 |
Correct |
211 ms |
39960 KB |
Output is correct |
61 |
Correct |
211 ms |
39956 KB |
Output is correct |
62 |
Correct |
212 ms |
39956 KB |
Output is correct |
63 |
Correct |
225 ms |
40016 KB |
Output is correct |
64 |
Correct |
27 ms |
30620 KB |
Output is correct |
65 |
Correct |
27 ms |
30584 KB |
Output is correct |
66 |
Correct |
28 ms |
30600 KB |
Output is correct |
67 |
Correct |
27 ms |
30616 KB |
Output is correct |
68 |
Correct |
807 ms |
36524 KB |
Output is correct |
69 |
Correct |
1002 ms |
36792 KB |
Output is correct |
70 |
Correct |
998 ms |
36880 KB |
Output is correct |
71 |
Correct |
1095 ms |
40112 KB |
Output is correct |
72 |
Correct |
1092 ms |
40104 KB |
Output is correct |
73 |
Correct |
1081 ms |
40132 KB |
Output is correct |
74 |
Correct |
890 ms |
40104 KB |
Output is correct |
75 |
Correct |
847 ms |
30636 KB |
Output is correct |
76 |
Correct |
726 ms |
30748 KB |
Output is correct |
77 |
Correct |
897 ms |
30632 KB |
Output is correct |
78 |
Correct |
723 ms |
30628 KB |
Output is correct |
79 |
Correct |
861 ms |
30572 KB |
Output is correct |
80 |
Correct |
804 ms |
30656 KB |
Output is correct |
81 |
Correct |
0 ms |
208 KB |
Output is correct |
82 |
Correct |
1 ms |
720 KB |
Output is correct |
83 |
Correct |
1 ms |
720 KB |
Output is correct |
84 |
Correct |
139 ms |
36764 KB |
Output is correct |
85 |
Correct |
225 ms |
40104 KB |
Output is correct |
86 |
Correct |
238 ms |
40104 KB |
Output is correct |
87 |
Correct |
28 ms |
30604 KB |
Output is correct |
88 |
Correct |
28 ms |
30676 KB |
Output is correct |
89 |
Correct |
149 ms |
36792 KB |
Output is correct |
90 |
Correct |
219 ms |
40084 KB |
Output is correct |
91 |
Correct |
212 ms |
40024 KB |
Output is correct |
92 |
Correct |
29 ms |
30608 KB |
Output is correct |
93 |
Correct |
34 ms |
30668 KB |
Output is correct |
94 |
Correct |
2 ms |
720 KB |
Output is correct |
95 |
Correct |
3 ms |
848 KB |
Output is correct |
96 |
Correct |
2 ms |
848 KB |
Output is correct |
97 |
Correct |
1 ms |
720 KB |
Output is correct |
98 |
Correct |
1 ms |
720 KB |
Output is correct |
99 |
Correct |
2 ms |
720 KB |
Output is correct |
100 |
Correct |
2 ms |
848 KB |
Output is correct |
101 |
Correct |
3 ms |
848 KB |
Output is correct |
102 |
Correct |
1 ms |
720 KB |
Output is correct |
103 |
Correct |
1 ms |
720 KB |
Output is correct |
104 |
Correct |
851 ms |
32812 KB |
Output is correct |
105 |
Correct |
998 ms |
36756 KB |
Output is correct |
106 |
Correct |
989 ms |
37024 KB |
Output is correct |
107 |
Correct |
954 ms |
40020 KB |
Output is correct |
108 |
Correct |
934 ms |
39976 KB |
Output is correct |
109 |
Correct |
1152 ms |
39952 KB |
Output is correct |
110 |
Correct |
1123 ms |
40032 KB |
Output is correct |
111 |
Correct |
650 ms |
30656 KB |
Output is correct |
112 |
Correct |
776 ms |
30664 KB |
Output is correct |
113 |
Correct |
734 ms |
30660 KB |
Output is correct |
114 |
Correct |
805 ms |
30636 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
306 ms |
17556 KB |
Output is correct |
2 |
Correct |
870 ms |
30664 KB |
Output is correct |
3 |
Correct |
700 ms |
30644 KB |
Output is correct |
4 |
Correct |
646 ms |
30640 KB |
Output is correct |
5 |
Correct |
809 ms |
30656 KB |
Output is correct |
6 |
Correct |
817 ms |
30656 KB |
Output is correct |
7 |
Correct |
728 ms |
30652 KB |
Output is correct |
8 |
Correct |
0 ms |
208 KB |
Output is correct |
9 |
Correct |
1 ms |
720 KB |
Output is correct |
10 |
Correct |
1 ms |
720 KB |
Output is correct |
11 |
Correct |
1 ms |
336 KB |
Output is correct |
12 |
Correct |
2 ms |
720 KB |
Output is correct |
13 |
Correct |
3 ms |
848 KB |
Output is correct |
14 |
Correct |
3 ms |
908 KB |
Output is correct |
15 |
Correct |
3 ms |
848 KB |
Output is correct |
16 |
Correct |
3 ms |
848 KB |
Output is correct |
17 |
Correct |
2 ms |
848 KB |
Output is correct |
18 |
Correct |
1 ms |
720 KB |
Output is correct |
19 |
Correct |
1 ms |
720 KB |
Output is correct |
20 |
Correct |
1 ms |
720 KB |
Output is correct |
21 |
Correct |
1 ms |
736 KB |
Output is correct |
22 |
Correct |
0 ms |
208 KB |
Output is correct |
23 |
Correct |
1 ms |
720 KB |
Output is correct |
24 |
Correct |
1 ms |
720 KB |
Output is correct |
25 |
Correct |
2 ms |
844 KB |
Output is correct |
26 |
Correct |
3 ms |
848 KB |
Output is correct |
27 |
Correct |
3 ms |
848 KB |
Output is correct |
28 |
Correct |
1 ms |
720 KB |
Output is correct |
29 |
Correct |
1 ms |
720 KB |
Output is correct |
30 |
Correct |
2 ms |
848 KB |
Output is correct |
31 |
Correct |
3 ms |
848 KB |
Output is correct |
32 |
Correct |
4 ms |
908 KB |
Output is correct |
33 |
Correct |
1 ms |
720 KB |
Output is correct |
34 |
Correct |
1 ms |
720 KB |
Output is correct |
35 |
Correct |
1 ms |
464 KB |
Output is correct |
36 |
Correct |
2 ms |
848 KB |
Output is correct |
37 |
Correct |
2 ms |
848 KB |
Output is correct |
38 |
Correct |
3 ms |
856 KB |
Output is correct |
39 |
Correct |
3 ms |
848 KB |
Output is correct |
40 |
Correct |
3 ms |
848 KB |
Output is correct |
41 |
Correct |
3 ms |
848 KB |
Output is correct |
42 |
Correct |
1 ms |
720 KB |
Output is correct |
43 |
Correct |
1 ms |
720 KB |
Output is correct |
44 |
Correct |
1 ms |
720 KB |
Output is correct |
45 |
Correct |
1 ms |
720 KB |
Output is correct |
46 |
Correct |
88 ms |
23060 KB |
Output is correct |
47 |
Correct |
141 ms |
36812 KB |
Output is correct |
48 |
Correct |
140 ms |
36876 KB |
Output is correct |
49 |
Correct |
233 ms |
40020 KB |
Output is correct |
50 |
Correct |
224 ms |
40072 KB |
Output is correct |
51 |
Correct |
226 ms |
40020 KB |
Output is correct |
52 |
Correct |
230 ms |
40104 KB |
Output is correct |
53 |
Correct |
32 ms |
30640 KB |
Output is correct |
54 |
Correct |
28 ms |
30636 KB |
Output is correct |
55 |
Correct |
28 ms |
30620 KB |
Output is correct |
56 |
Correct |
27 ms |
30616 KB |
Output is correct |
57 |
Correct |
160 ms |
36872 KB |
Output is correct |
58 |
Correct |
222 ms |
40068 KB |
Output is correct |
59 |
Correct |
216 ms |
40028 KB |
Output is correct |
60 |
Correct |
34 ms |
30656 KB |
Output is correct |
61 |
Correct |
28 ms |
30620 KB |
Output is correct |
62 |
Correct |
133 ms |
36760 KB |
Output is correct |
63 |
Correct |
222 ms |
40016 KB |
Output is correct |
64 |
Correct |
213 ms |
39972 KB |
Output is correct |
65 |
Correct |
27 ms |
30620 KB |
Output is correct |
66 |
Correct |
29 ms |
30660 KB |
Output is correct |
67 |
Correct |
137 ms |
35620 KB |
Output is correct |
68 |
Correct |
135 ms |
36828 KB |
Output is correct |
69 |
Correct |
144 ms |
36904 KB |
Output is correct |
70 |
Correct |
211 ms |
39960 KB |
Output is correct |
71 |
Correct |
211 ms |
39956 KB |
Output is correct |
72 |
Correct |
212 ms |
39956 KB |
Output is correct |
73 |
Correct |
225 ms |
40016 KB |
Output is correct |
74 |
Correct |
27 ms |
30620 KB |
Output is correct |
75 |
Correct |
27 ms |
30584 KB |
Output is correct |
76 |
Correct |
28 ms |
30600 KB |
Output is correct |
77 |
Correct |
27 ms |
30616 KB |
Output is correct |
78 |
Correct |
807 ms |
36524 KB |
Output is correct |
79 |
Correct |
1002 ms |
36792 KB |
Output is correct |
80 |
Correct |
998 ms |
36880 KB |
Output is correct |
81 |
Correct |
1095 ms |
40112 KB |
Output is correct |
82 |
Correct |
1092 ms |
40104 KB |
Output is correct |
83 |
Correct |
1081 ms |
40132 KB |
Output is correct |
84 |
Correct |
890 ms |
40104 KB |
Output is correct |
85 |
Correct |
847 ms |
30636 KB |
Output is correct |
86 |
Correct |
726 ms |
30748 KB |
Output is correct |
87 |
Correct |
897 ms |
30632 KB |
Output is correct |
88 |
Correct |
723 ms |
30628 KB |
Output is correct |
89 |
Correct |
861 ms |
30572 KB |
Output is correct |
90 |
Correct |
804 ms |
30656 KB |
Output is correct |
91 |
Correct |
0 ms |
208 KB |
Output is correct |
92 |
Correct |
1 ms |
720 KB |
Output is correct |
93 |
Correct |
1 ms |
720 KB |
Output is correct |
94 |
Correct |
139 ms |
36764 KB |
Output is correct |
95 |
Correct |
225 ms |
40104 KB |
Output is correct |
96 |
Correct |
238 ms |
40104 KB |
Output is correct |
97 |
Correct |
28 ms |
30604 KB |
Output is correct |
98 |
Correct |
28 ms |
30676 KB |
Output is correct |
99 |
Correct |
149 ms |
36792 KB |
Output is correct |
100 |
Correct |
219 ms |
40084 KB |
Output is correct |
101 |
Correct |
212 ms |
40024 KB |
Output is correct |
102 |
Correct |
29 ms |
30608 KB |
Output is correct |
103 |
Correct |
34 ms |
30668 KB |
Output is correct |
104 |
Correct |
2 ms |
720 KB |
Output is correct |
105 |
Correct |
3 ms |
848 KB |
Output is correct |
106 |
Correct |
2 ms |
848 KB |
Output is correct |
107 |
Correct |
1 ms |
720 KB |
Output is correct |
108 |
Correct |
1 ms |
720 KB |
Output is correct |
109 |
Correct |
2 ms |
720 KB |
Output is correct |
110 |
Correct |
2 ms |
848 KB |
Output is correct |
111 |
Correct |
3 ms |
848 KB |
Output is correct |
112 |
Correct |
1 ms |
720 KB |
Output is correct |
113 |
Correct |
1 ms |
720 KB |
Output is correct |
114 |
Correct |
253 ms |
8296 KB |
Output is correct |
115 |
Correct |
879 ms |
36776 KB |
Output is correct |
116 |
Correct |
1012 ms |
36796 KB |
Output is correct |
117 |
Correct |
1115 ms |
40016 KB |
Output is correct |
118 |
Correct |
962 ms |
39992 KB |
Output is correct |
119 |
Correct |
1163 ms |
39976 KB |
Output is correct |
120 |
Correct |
1113 ms |
39960 KB |
Output is correct |
121 |
Correct |
721 ms |
30632 KB |
Output is correct |
122 |
Correct |
857 ms |
30656 KB |
Output is correct |
123 |
Correct |
859 ms |
30640 KB |
Output is correct |
124 |
Correct |
675 ms |
30664 KB |
Output is correct |
125 |
Correct |
143 ms |
36792 KB |
Output is correct |
126 |
Correct |
213 ms |
40024 KB |
Output is correct |
127 |
Correct |
223 ms |
39964 KB |
Output is correct |
128 |
Correct |
28 ms |
30664 KB |
Output is correct |
129 |
Correct |
29 ms |
30628 KB |
Output is correct |
130 |
Correct |
128 ms |
35624 KB |
Output is correct |
131 |
Correct |
150 ms |
37024 KB |
Output is correct |
132 |
Correct |
142 ms |
36880 KB |
Output is correct |
133 |
Correct |
211 ms |
40020 KB |
Output is correct |
134 |
Correct |
224 ms |
39956 KB |
Output is correct |
135 |
Correct |
231 ms |
40024 KB |
Output is correct |
136 |
Correct |
221 ms |
40016 KB |
Output is correct |
137 |
Correct |
28 ms |
30620 KB |
Output is correct |
138 |
Correct |
31 ms |
30628 KB |
Output is correct |
139 |
Correct |
28 ms |
30660 KB |
Output is correct |
140 |
Correct |
36 ms |
30616 KB |
Output is correct |
141 |
Correct |
2 ms |
848 KB |
Output is correct |
142 |
Correct |
3 ms |
848 KB |
Output is correct |
143 |
Correct |
3 ms |
848 KB |
Output is correct |
144 |
Correct |
1 ms |
720 KB |
Output is correct |
145 |
Correct |
1 ms |
720 KB |
Output is correct |
146 |
Correct |
1 ms |
464 KB |
Output is correct |
147 |
Correct |
2 ms |
848 KB |
Output is correct |
148 |
Correct |
2 ms |
720 KB |
Output is correct |
149 |
Correct |
3 ms |
848 KB |
Output is correct |
150 |
Correct |
2 ms |
848 KB |
Output is correct |
151 |
Correct |
3 ms |
848 KB |
Output is correct |
152 |
Correct |
3 ms |
848 KB |
Output is correct |
153 |
Correct |
1 ms |
720 KB |
Output is correct |
154 |
Correct |
1 ms |
720 KB |
Output is correct |
155 |
Correct |
1 ms |
720 KB |
Output is correct |
156 |
Correct |
1 ms |
720 KB |
Output is correct |
157 |
Correct |
851 ms |
32812 KB |
Output is correct |
158 |
Correct |
998 ms |
36756 KB |
Output is correct |
159 |
Correct |
989 ms |
37024 KB |
Output is correct |
160 |
Correct |
954 ms |
40020 KB |
Output is correct |
161 |
Correct |
934 ms |
39976 KB |
Output is correct |
162 |
Correct |
1152 ms |
39952 KB |
Output is correct |
163 |
Correct |
1123 ms |
40032 KB |
Output is correct |
164 |
Correct |
650 ms |
30656 KB |
Output is correct |
165 |
Correct |
776 ms |
30664 KB |
Output is correct |
166 |
Correct |
734 ms |
30660 KB |
Output is correct |
167 |
Correct |
805 ms |
30636 KB |
Output is correct |
168 |
Correct |
1 ms |
208 KB |
Output is correct |
169 |
Correct |
3729 ms |
12468 KB |
Output is correct |
170 |
Execution timed out |
4067 ms |
36764 KB |
Time limit exceeded |
171 |
Halted |
0 ms |
0 KB |
- |