#include<bits/stdc++.h>
using namespace std;
vector<long long> idk(500001);
vector<long long> lol(500001);
vector<long long> no(500001);
vector<pair<long long,long long>> roll(0);
void reset() {
for(int i = (int)roll.size()-1; i >= 0; i--) {
lol[roll[i].second] = roll[i].first;
}
roll.clear();
}
void upd2(long long a, long long x) {
while(a < lol.size()) {
roll.push_back({lol[a],a});
lol[a]+=x;
a+=(a&(-a));
}
}
long long calc2(long long a) {
long long c = 0,sb = 0;
for(long long i = 19; i >= 0; i--) {
if(c+(1 << i) <= a) {
c+=(1 << i);
sb+=lol[c];
}
}
return sb;
}
pair<long long, long long> dude(long long n, vector<long long>& haha, vector<long long>& bruh, long long q) {
long long ans1 = LLONG_MAX,ans2 = LLONG_MAX;
reset();
long long br = n;
long long s = haha.size()+bruh.size();
long long y1 = 0,y2 = 0,z1 = (long long)haha.size()-1,z2 = (long long)bruh.size()-1;
vector<long long> sb1(s+1,-1);
vector<long long> sb2(s+1,-1);
sb1[0] = 0;
sb2[0] = 0;
vector<pair<long long,long long>> idk1(1,{0,0});
vector<pair<long long,long long>> idk2(1,{0,0});
for(long long i = 1; i <= s; i++) {
long long a;
if(i%2) {
if(y1 >= haha.size()) {
break;
}
a = haha[y1];
y1++;
}
else {
if(y2 >= bruh.size()) {
break;
}
a = bruh[y2];
y2++;
}
upd2(a,-1);
sb1[i] = sb1[i-1]+calc2(a)+a;
idk1.push_back({y1,y2});
}
reset();
for(int x: haha) {
br--;
upd2(x,1);
}
for(int x: bruh) {
br--;
upd2(x,1);
}
for(long long i = 1; i <= s; i++) {
long long a;
if((i+n)%2) {
if(z1 < 0) {
break;
}
a = haha[z1];
z1--;
}
else {
if(z2 < 0) {
break;
}
a = bruh[z2];
z2--;
}
sb2[i] = sb2[i-1]+calc2(a)-a+br;
upd2(a,1);
idk2.push_back({(long long)haha.size()-z1-1,(long long)bruh.size()-z2-1});
}
while(idk1.size() <= s+1) {
idk1.push_back({-1,-1});
}
while(idk2.size() <= s+1) {
idk2.push_back({-1,-1});
}
for(long long i = 0; i <= s; i++) {
if(sb1[i] != -1 && sb2[s-i] != -1) {
if(idk1[i].first+idk2[s-i].first == haha.size() && idk1[i].second+idk2[s-i].second == bruh.size()) {
if(i%2 == 0) {
ans1 = min(ans1,sb1[i]+sb2[s-i]);
}
else {
ans2 = min(ans2,sb1[i]+sb2[s-i]);
}
}
}
}
return {ans1,ans2};
}
void upd(long long a, long long x) {
while(a < idk.size()) {
idk[a]+=x;
a+=(a&(-a));
}
}
long long calc(long long a) {
long long c = 0,sb = 0;
for(long long i = 19; i >= 0; i--) {
if(c+(1 << i) <= a) {
c+=(1 << i);
sb+=idk[c];
}
}
return sb;
}
int main()
{
ios_base::sync_with_stdio(NULL);
cin.tie(NULL);
cout.tie(NULL);
long long n,ans = 0;
cin >> n;
vector<long long> haha(n+1);
vector<pair<long long,long long>> wut(0);
vector<long long> dp0(n+1,LLONG_MAX);
vector<long long> dp1(n+1,LLONG_MAX);
dp0[0] = 0;
for(long long i = 1; i <= n; i++) {
cin >> haha[i];
no[i] = haha[i];
wut.push_back({-abs(haha[i]),i});
}
sort(wut.begin(),wut.end());
for(int i = 0; i < n; i++) {
wut[i] = {-wut[i].first,wut[i].second};
}
for(long long i = 1; i <= n; i++) {
upd(i,1);
}
long long y = 0;
while(y < n) {
long long a = wut[y].first;
if(a == 0) {
dp0[n] = dp0[y];
dp1[n] = dp1[y];
}
vector<long long> banana1(0);
vector<long long> banana2(0);
long long r = n-1;
for(long long i = y; i < n; i++) {
if(abs(wut[i].first) != a) {
r = i-1;
break;
}
}
for(long long i = y; i <= r; i++) {
long long c = 0;
if(haha[wut[i].second] > 0) {
c = 1;
}
if((c+wut[i].second)%2) {
banana1.push_back(calc(wut[i].second));
}
else {
banana2.push_back(calc(wut[i].second));
}
}
pair<long long,long long> x = dude(n-y,banana1,banana2,a);
if(dp0[y] != LLONG_MAX) {
if(x.first != LLONG_MAX) {
dp0[r+1] = min(dp0[r+1],dp0[y]+x.first);
}
if(x.second != LLONG_MAX) {
dp1[r+1] = min(dp1[r+1],dp0[y]+x.second);
}
}
x = dude(n-y,banana2,banana1,a);
if(dp1[y] != LLONG_MAX) {
if(x.first != LLONG_MAX) {
dp1[r+1] = min(dp1[r+1],dp1[y]+x.first);
}
if(x.second != LLONG_MAX) {
dp0[r+1] = min(dp0[r+1],dp1[y]+x.second);
}
}
for(int i = y; i <= r; i++) {
upd(wut[i].second,-1);
}
y = r+1;
}
ans = min(dp0[n],dp1[n]);
if(ans == LLONG_MAX) {
cout << -1;
}
else {
cout << ans;
}
return 0;
}
Compilation message
Main.cpp: In function 'void upd2(long long int, long long int)':
Main.cpp:17:13: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
17 | while(a < lol.size()) {
| ~~^~~~~~~~~~~~
Main.cpp: In function 'std::pair<long long int, long long int> dude(long long int, std::vector<long long int>&, std::vector<long long int>&, long long int)':
Main.cpp:50:19: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
50 | if(y1 >= haha.size()) {
| ~~~^~~~~~~~~~~~~~
Main.cpp:57:19: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
57 | if(y2 >= bruh.size()) {
| ~~~^~~~~~~~~~~~~~
Main.cpp:96:23: warning: comparison of integer expressions of different signedness: 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
96 | while(idk1.size() <= s+1) {
| ~~~~~~~~~~~~^~~~~~
Main.cpp:99:23: warning: comparison of integer expressions of different signedness: 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
99 | while(idk2.size() <= s+1) {
| ~~~~~~~~~~~~^~~~~~
Main.cpp:104:46: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
104 | if(idk1[i].first+idk2[s-i].first == haha.size() && idk1[i].second+idk2[s-i].second == bruh.size()) {
Main.cpp:104:96: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
104 | if(idk1[i].first+idk2[s-i].first == haha.size() && idk1[i].second+idk2[s-i].second == bruh.size()) {
Main.cpp: In function 'void upd(long long int, long long int)':
Main.cpp:118:13: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
118 | while(a < idk.size()) {
| ~~^~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
12124 KB |
Output is correct |
2 |
Correct |
5 ms |
12124 KB |
Output is correct |
3 |
Correct |
5 ms |
12124 KB |
Output is correct |
4 |
Correct |
7 ms |
13460 KB |
Output is correct |
5 |
Correct |
8 ms |
13480 KB |
Output is correct |
6 |
Correct |
7 ms |
13304 KB |
Output is correct |
7 |
Correct |
7 ms |
13304 KB |
Output is correct |
8 |
Correct |
7 ms |
13456 KB |
Output is correct |
9 |
Correct |
9 ms |
13304 KB |
Output is correct |
10 |
Correct |
9 ms |
13304 KB |
Output is correct |
11 |
Correct |
7 ms |
13300 KB |
Output is correct |
12 |
Correct |
7 ms |
13400 KB |
Output is correct |
13 |
Correct |
6 ms |
13304 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
12124 KB |
Output is correct |
2 |
Correct |
5 ms |
12124 KB |
Output is correct |
3 |
Correct |
5 ms |
12124 KB |
Output is correct |
4 |
Correct |
7 ms |
13460 KB |
Output is correct |
5 |
Correct |
8 ms |
13480 KB |
Output is correct |
6 |
Correct |
7 ms |
13304 KB |
Output is correct |
7 |
Correct |
7 ms |
13304 KB |
Output is correct |
8 |
Correct |
7 ms |
13456 KB |
Output is correct |
9 |
Correct |
9 ms |
13304 KB |
Output is correct |
10 |
Correct |
9 ms |
13304 KB |
Output is correct |
11 |
Correct |
7 ms |
13300 KB |
Output is correct |
12 |
Correct |
7 ms |
13400 KB |
Output is correct |
13 |
Correct |
6 ms |
13304 KB |
Output is correct |
14 |
Correct |
4 ms |
12124 KB |
Output is correct |
15 |
Correct |
495 ms |
329752 KB |
Output is correct |
16 |
Correct |
486 ms |
333068 KB |
Output is correct |
17 |
Correct |
488 ms |
329736 KB |
Output is correct |
18 |
Correct |
471 ms |
330100 KB |
Output is correct |
19 |
Correct |
473 ms |
330172 KB |
Output is correct |
20 |
Correct |
528 ms |
333496 KB |
Output is correct |
21 |
Correct |
523 ms |
333496 KB |
Output is correct |
22 |
Correct |
499 ms |
333496 KB |
Output is correct |
23 |
Correct |
529 ms |
333752 KB |
Output is correct |
24 |
Correct |
515 ms |
333572 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
12124 KB |
Output is correct |
2 |
Correct |
5 ms |
12124 KB |
Output is correct |
3 |
Correct |
5 ms |
12124 KB |
Output is correct |
4 |
Correct |
7 ms |
13460 KB |
Output is correct |
5 |
Correct |
8 ms |
13480 KB |
Output is correct |
6 |
Correct |
7 ms |
13304 KB |
Output is correct |
7 |
Correct |
7 ms |
13304 KB |
Output is correct |
8 |
Correct |
7 ms |
13456 KB |
Output is correct |
9 |
Correct |
9 ms |
13304 KB |
Output is correct |
10 |
Correct |
9 ms |
13304 KB |
Output is correct |
11 |
Correct |
7 ms |
13300 KB |
Output is correct |
12 |
Correct |
7 ms |
13400 KB |
Output is correct |
13 |
Correct |
6 ms |
13304 KB |
Output is correct |
14 |
Correct |
5 ms |
12124 KB |
Output is correct |
15 |
Correct |
4 ms |
12020 KB |
Output is correct |
16 |
Correct |
4 ms |
12140 KB |
Output is correct |
17 |
Correct |
7 ms |
12760 KB |
Output is correct |
18 |
Correct |
7 ms |
12860 KB |
Output is correct |
19 |
Correct |
11 ms |
12796 KB |
Output is correct |
20 |
Correct |
7 ms |
12760 KB |
Output is correct |
21 |
Correct |
7 ms |
13484 KB |
Output is correct |
22 |
Correct |
7 ms |
13556 KB |
Output is correct |
23 |
Correct |
7 ms |
12760 KB |
Output is correct |
24 |
Correct |
6 ms |
12892 KB |
Output is correct |
25 |
Correct |
7 ms |
12760 KB |
Output is correct |
26 |
Correct |
7 ms |
12756 KB |
Output is correct |
27 |
Correct |
7 ms |
13740 KB |
Output is correct |
28 |
Correct |
7 ms |
13500 KB |
Output is correct |
29 |
Correct |
7 ms |
13304 KB |
Output is correct |
30 |
Correct |
7 ms |
13304 KB |
Output is correct |
31 |
Correct |
7 ms |
13504 KB |
Output is correct |
32 |
Correct |
7 ms |
13392 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
12124 KB |
Output is correct |
2 |
Correct |
5 ms |
12124 KB |
Output is correct |
3 |
Correct |
5 ms |
12124 KB |
Output is correct |
4 |
Correct |
7 ms |
13460 KB |
Output is correct |
5 |
Correct |
8 ms |
13480 KB |
Output is correct |
6 |
Correct |
7 ms |
13304 KB |
Output is correct |
7 |
Correct |
7 ms |
13304 KB |
Output is correct |
8 |
Correct |
7 ms |
13456 KB |
Output is correct |
9 |
Correct |
9 ms |
13304 KB |
Output is correct |
10 |
Correct |
9 ms |
13304 KB |
Output is correct |
11 |
Correct |
7 ms |
13300 KB |
Output is correct |
12 |
Correct |
7 ms |
13400 KB |
Output is correct |
13 |
Correct |
6 ms |
13304 KB |
Output is correct |
14 |
Correct |
4 ms |
12124 KB |
Output is correct |
15 |
Correct |
495 ms |
329752 KB |
Output is correct |
16 |
Correct |
486 ms |
333068 KB |
Output is correct |
17 |
Correct |
488 ms |
329736 KB |
Output is correct |
18 |
Correct |
471 ms |
330100 KB |
Output is correct |
19 |
Correct |
473 ms |
330172 KB |
Output is correct |
20 |
Correct |
528 ms |
333496 KB |
Output is correct |
21 |
Correct |
523 ms |
333496 KB |
Output is correct |
22 |
Correct |
499 ms |
333496 KB |
Output is correct |
23 |
Correct |
529 ms |
333752 KB |
Output is correct |
24 |
Correct |
515 ms |
333572 KB |
Output is correct |
25 |
Correct |
5 ms |
12124 KB |
Output is correct |
26 |
Correct |
4 ms |
12020 KB |
Output is correct |
27 |
Correct |
4 ms |
12140 KB |
Output is correct |
28 |
Correct |
7 ms |
12760 KB |
Output is correct |
29 |
Correct |
7 ms |
12860 KB |
Output is correct |
30 |
Correct |
11 ms |
12796 KB |
Output is correct |
31 |
Correct |
7 ms |
12760 KB |
Output is correct |
32 |
Correct |
7 ms |
13484 KB |
Output is correct |
33 |
Correct |
7 ms |
13556 KB |
Output is correct |
34 |
Correct |
7 ms |
12760 KB |
Output is correct |
35 |
Correct |
6 ms |
12892 KB |
Output is correct |
36 |
Correct |
7 ms |
12760 KB |
Output is correct |
37 |
Correct |
7 ms |
12756 KB |
Output is correct |
38 |
Correct |
7 ms |
13740 KB |
Output is correct |
39 |
Correct |
7 ms |
13500 KB |
Output is correct |
40 |
Correct |
7 ms |
13304 KB |
Output is correct |
41 |
Correct |
7 ms |
13304 KB |
Output is correct |
42 |
Correct |
7 ms |
13504 KB |
Output is correct |
43 |
Correct |
7 ms |
13392 KB |
Output is correct |
44 |
Correct |
467 ms |
181624 KB |
Output is correct |
45 |
Correct |
458 ms |
181572 KB |
Output is correct |
46 |
Correct |
447 ms |
181560 KB |
Output is correct |
47 |
Correct |
476 ms |
181460 KB |
Output is correct |
48 |
Correct |
462 ms |
185760 KB |
Output is correct |
49 |
Correct |
518 ms |
333500 KB |
Output is correct |
50 |
Correct |
449 ms |
183132 KB |
Output is correct |
51 |
Correct |
447 ms |
183100 KB |
Output is correct |
52 |
Correct |
451 ms |
183248 KB |
Output is correct |
53 |
Correct |
472 ms |
183448 KB |
Output is correct |
54 |
Correct |
453 ms |
185460 KB |
Output is correct |
55 |
Correct |
464 ms |
185404 KB |
Output is correct |
56 |
Correct |
485 ms |
185660 KB |
Output is correct |
57 |
Correct |
496 ms |
329660 KB |
Output is correct |
58 |
Correct |
508 ms |
329660 KB |
Output is correct |
59 |
Correct |
493 ms |
332684 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
12124 KB |
Output is correct |
2 |
Correct |
4 ms |
12124 KB |
Output is correct |
3 |
Correct |
6 ms |
12124 KB |
Output is correct |
4 |
Correct |
6 ms |
12124 KB |
Output is correct |
5 |
Correct |
6 ms |
12292 KB |
Output is correct |
6 |
Correct |
7 ms |
12288 KB |
Output is correct |
7 |
Correct |
7 ms |
12124 KB |
Output is correct |
8 |
Correct |
6 ms |
12124 KB |
Output is correct |
9 |
Correct |
4 ms |
12040 KB |
Output is correct |
10 |
Correct |
5 ms |
12120 KB |
Output is correct |
11 |
Correct |
7 ms |
12120 KB |
Output is correct |
12 |
Correct |
6 ms |
12124 KB |
Output is correct |
13 |
Correct |
7 ms |
12124 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
12124 KB |
Output is correct |
2 |
Correct |
4 ms |
12124 KB |
Output is correct |
3 |
Correct |
6 ms |
12124 KB |
Output is correct |
4 |
Correct |
6 ms |
12124 KB |
Output is correct |
5 |
Correct |
6 ms |
12292 KB |
Output is correct |
6 |
Correct |
7 ms |
12288 KB |
Output is correct |
7 |
Correct |
7 ms |
12124 KB |
Output is correct |
8 |
Correct |
6 ms |
12124 KB |
Output is correct |
9 |
Correct |
4 ms |
12040 KB |
Output is correct |
10 |
Correct |
5 ms |
12120 KB |
Output is correct |
11 |
Correct |
7 ms |
12120 KB |
Output is correct |
12 |
Correct |
6 ms |
12124 KB |
Output is correct |
13 |
Correct |
7 ms |
12124 KB |
Output is correct |
14 |
Correct |
392 ms |
36848 KB |
Output is correct |
15 |
Correct |
516 ms |
37048 KB |
Output is correct |
16 |
Correct |
472 ms |
35400 KB |
Output is correct |
17 |
Correct |
508 ms |
35292 KB |
Output is correct |
18 |
Correct |
502 ms |
35268 KB |
Output is correct |
19 |
Correct |
441 ms |
35780 KB |
Output is correct |
20 |
Correct |
4 ms |
12124 KB |
Output is correct |
21 |
Correct |
4 ms |
12060 KB |
Output is correct |
22 |
Correct |
433 ms |
36920 KB |
Output is correct |
23 |
Correct |
543 ms |
36800 KB |
Output is correct |
24 |
Correct |
551 ms |
35228 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
12124 KB |
Output is correct |
2 |
Correct |
5 ms |
12124 KB |
Output is correct |
3 |
Correct |
5 ms |
12124 KB |
Output is correct |
4 |
Correct |
7 ms |
13460 KB |
Output is correct |
5 |
Correct |
8 ms |
13480 KB |
Output is correct |
6 |
Correct |
7 ms |
13304 KB |
Output is correct |
7 |
Correct |
7 ms |
13304 KB |
Output is correct |
8 |
Correct |
7 ms |
13456 KB |
Output is correct |
9 |
Correct |
9 ms |
13304 KB |
Output is correct |
10 |
Correct |
9 ms |
13304 KB |
Output is correct |
11 |
Correct |
7 ms |
13300 KB |
Output is correct |
12 |
Correct |
7 ms |
13400 KB |
Output is correct |
13 |
Correct |
6 ms |
13304 KB |
Output is correct |
14 |
Correct |
5 ms |
12124 KB |
Output is correct |
15 |
Correct |
4 ms |
12020 KB |
Output is correct |
16 |
Correct |
4 ms |
12140 KB |
Output is correct |
17 |
Correct |
7 ms |
12760 KB |
Output is correct |
18 |
Correct |
7 ms |
12860 KB |
Output is correct |
19 |
Correct |
11 ms |
12796 KB |
Output is correct |
20 |
Correct |
7 ms |
12760 KB |
Output is correct |
21 |
Correct |
7 ms |
13484 KB |
Output is correct |
22 |
Correct |
7 ms |
13556 KB |
Output is correct |
23 |
Correct |
7 ms |
12760 KB |
Output is correct |
24 |
Correct |
6 ms |
12892 KB |
Output is correct |
25 |
Correct |
7 ms |
12760 KB |
Output is correct |
26 |
Correct |
7 ms |
12756 KB |
Output is correct |
27 |
Correct |
7 ms |
13740 KB |
Output is correct |
28 |
Correct |
7 ms |
13500 KB |
Output is correct |
29 |
Correct |
7 ms |
13304 KB |
Output is correct |
30 |
Correct |
7 ms |
13304 KB |
Output is correct |
31 |
Correct |
7 ms |
13504 KB |
Output is correct |
32 |
Correct |
7 ms |
13392 KB |
Output is correct |
33 |
Correct |
4 ms |
12124 KB |
Output is correct |
34 |
Correct |
4 ms |
12124 KB |
Output is correct |
35 |
Correct |
6 ms |
12124 KB |
Output is correct |
36 |
Correct |
6 ms |
12124 KB |
Output is correct |
37 |
Correct |
6 ms |
12292 KB |
Output is correct |
38 |
Correct |
7 ms |
12288 KB |
Output is correct |
39 |
Correct |
7 ms |
12124 KB |
Output is correct |
40 |
Correct |
6 ms |
12124 KB |
Output is correct |
41 |
Correct |
4 ms |
12040 KB |
Output is correct |
42 |
Correct |
5 ms |
12120 KB |
Output is correct |
43 |
Correct |
7 ms |
12120 KB |
Output is correct |
44 |
Correct |
6 ms |
12124 KB |
Output is correct |
45 |
Correct |
7 ms |
12124 KB |
Output is correct |
46 |
Correct |
7 ms |
12124 KB |
Output is correct |
47 |
Correct |
6 ms |
12348 KB |
Output is correct |
48 |
Correct |
6 ms |
12124 KB |
Output is correct |
49 |
Correct |
7 ms |
12272 KB |
Output is correct |
50 |
Correct |
7 ms |
12380 KB |
Output is correct |
51 |
Correct |
7 ms |
12760 KB |
Output is correct |
52 |
Correct |
7 ms |
12760 KB |
Output is correct |
53 |
Correct |
7 ms |
12760 KB |
Output is correct |
54 |
Correct |
6 ms |
12124 KB |
Output is correct |
55 |
Correct |
10 ms |
13556 KB |
Output is correct |
56 |
Correct |
4 ms |
12124 KB |
Output is correct |
57 |
Correct |
4 ms |
12124 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
12124 KB |
Output is correct |
2 |
Correct |
5 ms |
12124 KB |
Output is correct |
3 |
Correct |
5 ms |
12124 KB |
Output is correct |
4 |
Correct |
7 ms |
13460 KB |
Output is correct |
5 |
Correct |
8 ms |
13480 KB |
Output is correct |
6 |
Correct |
7 ms |
13304 KB |
Output is correct |
7 |
Correct |
7 ms |
13304 KB |
Output is correct |
8 |
Correct |
7 ms |
13456 KB |
Output is correct |
9 |
Correct |
9 ms |
13304 KB |
Output is correct |
10 |
Correct |
9 ms |
13304 KB |
Output is correct |
11 |
Correct |
7 ms |
13300 KB |
Output is correct |
12 |
Correct |
7 ms |
13400 KB |
Output is correct |
13 |
Correct |
6 ms |
13304 KB |
Output is correct |
14 |
Correct |
4 ms |
12124 KB |
Output is correct |
15 |
Correct |
495 ms |
329752 KB |
Output is correct |
16 |
Correct |
486 ms |
333068 KB |
Output is correct |
17 |
Correct |
488 ms |
329736 KB |
Output is correct |
18 |
Correct |
471 ms |
330100 KB |
Output is correct |
19 |
Correct |
473 ms |
330172 KB |
Output is correct |
20 |
Correct |
528 ms |
333496 KB |
Output is correct |
21 |
Correct |
523 ms |
333496 KB |
Output is correct |
22 |
Correct |
499 ms |
333496 KB |
Output is correct |
23 |
Correct |
529 ms |
333752 KB |
Output is correct |
24 |
Correct |
515 ms |
333572 KB |
Output is correct |
25 |
Correct |
5 ms |
12124 KB |
Output is correct |
26 |
Correct |
4 ms |
12020 KB |
Output is correct |
27 |
Correct |
4 ms |
12140 KB |
Output is correct |
28 |
Correct |
7 ms |
12760 KB |
Output is correct |
29 |
Correct |
7 ms |
12860 KB |
Output is correct |
30 |
Correct |
11 ms |
12796 KB |
Output is correct |
31 |
Correct |
7 ms |
12760 KB |
Output is correct |
32 |
Correct |
7 ms |
13484 KB |
Output is correct |
33 |
Correct |
7 ms |
13556 KB |
Output is correct |
34 |
Correct |
7 ms |
12760 KB |
Output is correct |
35 |
Correct |
6 ms |
12892 KB |
Output is correct |
36 |
Correct |
7 ms |
12760 KB |
Output is correct |
37 |
Correct |
7 ms |
12756 KB |
Output is correct |
38 |
Correct |
7 ms |
13740 KB |
Output is correct |
39 |
Correct |
7 ms |
13500 KB |
Output is correct |
40 |
Correct |
7 ms |
13304 KB |
Output is correct |
41 |
Correct |
7 ms |
13304 KB |
Output is correct |
42 |
Correct |
7 ms |
13504 KB |
Output is correct |
43 |
Correct |
7 ms |
13392 KB |
Output is correct |
44 |
Correct |
467 ms |
181624 KB |
Output is correct |
45 |
Correct |
458 ms |
181572 KB |
Output is correct |
46 |
Correct |
447 ms |
181560 KB |
Output is correct |
47 |
Correct |
476 ms |
181460 KB |
Output is correct |
48 |
Correct |
462 ms |
185760 KB |
Output is correct |
49 |
Correct |
518 ms |
333500 KB |
Output is correct |
50 |
Correct |
449 ms |
183132 KB |
Output is correct |
51 |
Correct |
447 ms |
183100 KB |
Output is correct |
52 |
Correct |
451 ms |
183248 KB |
Output is correct |
53 |
Correct |
472 ms |
183448 KB |
Output is correct |
54 |
Correct |
453 ms |
185460 KB |
Output is correct |
55 |
Correct |
464 ms |
185404 KB |
Output is correct |
56 |
Correct |
485 ms |
185660 KB |
Output is correct |
57 |
Correct |
496 ms |
329660 KB |
Output is correct |
58 |
Correct |
508 ms |
329660 KB |
Output is correct |
59 |
Correct |
493 ms |
332684 KB |
Output is correct |
60 |
Correct |
4 ms |
12124 KB |
Output is correct |
61 |
Correct |
4 ms |
12124 KB |
Output is correct |
62 |
Correct |
6 ms |
12124 KB |
Output is correct |
63 |
Correct |
6 ms |
12124 KB |
Output is correct |
64 |
Correct |
6 ms |
12292 KB |
Output is correct |
65 |
Correct |
7 ms |
12288 KB |
Output is correct |
66 |
Correct |
7 ms |
12124 KB |
Output is correct |
67 |
Correct |
6 ms |
12124 KB |
Output is correct |
68 |
Correct |
4 ms |
12040 KB |
Output is correct |
69 |
Correct |
5 ms |
12120 KB |
Output is correct |
70 |
Correct |
7 ms |
12120 KB |
Output is correct |
71 |
Correct |
6 ms |
12124 KB |
Output is correct |
72 |
Correct |
7 ms |
12124 KB |
Output is correct |
73 |
Correct |
392 ms |
36848 KB |
Output is correct |
74 |
Correct |
516 ms |
37048 KB |
Output is correct |
75 |
Correct |
472 ms |
35400 KB |
Output is correct |
76 |
Correct |
508 ms |
35292 KB |
Output is correct |
77 |
Correct |
502 ms |
35268 KB |
Output is correct |
78 |
Correct |
441 ms |
35780 KB |
Output is correct |
79 |
Correct |
4 ms |
12124 KB |
Output is correct |
80 |
Correct |
4 ms |
12060 KB |
Output is correct |
81 |
Correct |
433 ms |
36920 KB |
Output is correct |
82 |
Correct |
543 ms |
36800 KB |
Output is correct |
83 |
Correct |
551 ms |
35228 KB |
Output is correct |
84 |
Correct |
7 ms |
12124 KB |
Output is correct |
85 |
Correct |
6 ms |
12348 KB |
Output is correct |
86 |
Correct |
6 ms |
12124 KB |
Output is correct |
87 |
Correct |
7 ms |
12272 KB |
Output is correct |
88 |
Correct |
7 ms |
12380 KB |
Output is correct |
89 |
Correct |
7 ms |
12760 KB |
Output is correct |
90 |
Correct |
7 ms |
12760 KB |
Output is correct |
91 |
Correct |
7 ms |
12760 KB |
Output is correct |
92 |
Correct |
6 ms |
12124 KB |
Output is correct |
93 |
Correct |
10 ms |
13556 KB |
Output is correct |
94 |
Correct |
4 ms |
12124 KB |
Output is correct |
95 |
Correct |
4 ms |
12124 KB |
Output is correct |
96 |
Correct |
464 ms |
110536 KB |
Output is correct |
97 |
Correct |
470 ms |
110896 KB |
Output is correct |
98 |
Correct |
452 ms |
111232 KB |
Output is correct |
99 |
Correct |
415 ms |
35264 KB |
Output is correct |
100 |
Correct |
580 ms |
188596 KB |
Output is correct |
101 |
Correct |
526 ms |
36924 KB |
Output is correct |
102 |
Correct |
530 ms |
37000 KB |
Output is correct |
103 |
Correct |
487 ms |
35260 KB |
Output is correct |
104 |
Correct |
509 ms |
34496 KB |
Output is correct |
105 |
Correct |
457 ms |
34744 KB |
Output is correct |
106 |
Correct |
450 ms |
41408 KB |
Output is correct |