#include <bits/stdc++.h>
using namespace std;
typedef pair<long long,long long> P;
priority_queue<P> pq;
int arr[500001];
int n;
int tree[500005];
const long long INF=1e13;
int sum(int i) {
int ret=0;
while (i>0) {
ret+=tree[i];
i-=(i&-i);
}
return ret;
}
void upd(int i,int val) {
while (i<=n) {
tree[i]+=val;
i+=(i&-i);
}
}
P solve(vector<int> vec0,vector<int> vec1,int sz) {
bool stone=true;
bool enone=(sz%2==0);
long long value0=INF;
long long value1=INF;
long long val=0;
int k=vec0.size();
//printf("%d %d %d\n",now,vec0.size(),vec1.size());
if (vec1.size()>vec0.size()+2) {
return P(INF,INF);
}
else if (vec1.size()==vec0.size()+2) {
if (!enone) {
return P(INF,INF);
}
for(int i=0;i<k;i++) {
val+=sum(vec1[i]-1);
upd(vec1[i],-1);
val+=sum(vec0[i]-1);
upd(vec0[i],-1);
}
val+=sum(vec1[k]-1);
upd(vec1[k],-1);
val+=sum(n)-sum(vec1[k+1]);
upd(vec1[k+1],-1);
value1=min(value1,val);
for(int i=k-1;i>=0;i--) {
if (vec0[i]<vec1[i+1]) {
val++;
}
else {
val--;
}
val-=2*sum(vec0[i])-sum(n);
val-=2*sum(vec1[i+1])-sum(n);
value1=min(value1,val);
}
}
else if (vec1.size()==vec0.size()+1) {
if (enone) {
for(int i=0;i<k;i++) {
val+=sum(vec1[i]-1);
upd(vec1[i],-1);
val+=sum(vec0[i]-1);
upd(vec0[i],-1);
}
val+=sum(vec1[k]-1);
upd(vec1[k],-1);
value1=min(value1,val);
for(int i=k-1;i>=0;i--) {
val-=2*sum(vec1[i+1])-sum(n);
value0=min(value0,val);
val-=2*sum(vec0[i])-sum(n);
value1=min(value1,val);
}
val-=2*sum(vec1[0])-sum(n);
value0=min(value0,val);
}
else {
for(int i=0;i<k;i++) {
val+=sum(vec1[i]-1);
upd(vec1[i],-1);
val+=sum(vec0[i]-1);
upd(vec0[i],-1);
}
val+=sum(vec1[k]-1);
upd(vec1[k],-1);
value1=min(value1,val);
for(int i=k-1;i>=0;i--) {
if (vec0[i]<vec1[i+1]) {
val++;
}
else {
val--;
}
val-=2*sum(vec0[i])-sum(n);
val-=2*sum(vec1[i+1])-sum(n);
value1=min(value1,val);
}
}
}
else if (vec1.size()==vec0.size()) {
if (enone) {
for(int i=0;i<k;i++) {
val+=sum(vec1[i]-1);
upd(vec1[i],-1);
val+=sum(vec0[i]-1);
upd(vec0[i],-1);
}
value0=min(value0,val);
for(int i=k-1;i>=0;i--) {
if (vec0[i]>vec1[i]) {
val++;
}
else {
val--;
}
val-=2*sum(vec0[i])-sum(n);
val-=2*sum(vec1[i])-sum(n);
value0=min(value0,val);
}
}
else {
for(int i=0;i<k;i++) {
val+=sum(vec1[i]-1);
upd(vec1[i],-1);
val+=sum(vec0[i]-1);
upd(vec0[i],-1);
}
value0=min(value0,val);
for(int i=k-1;i>=0;i--) {
val-=2*sum(vec0[i])-sum(n);
value1=min(value1,val);
val-=2*sum(vec1[i])-sum(n);
value0=min(value0,val);
}
}
}
else if (vec1.size()+1==vec0.size()) {
if (enone) {
return P(INF,INF);
}
for(int i=0;i<k-1;i++) {
val+=sum(vec1[i]-1);
upd(vec1[i],-1);
val+=sum(vec0[i]-1);
upd(vec0[i],-1);
}
val+=sum(n)-sum(vec0[k-1]);
upd(vec0[k-1],-1);
value0=min(value0,val);
for(int i=k-2;i>=0;i--) {
if (vec0[i]>vec1[i]) {
val++;
}
else {
val--;
}
val-=2*sum(vec0[i])-sum(n);
val-=2*sum(vec1[i])-sum(n);
value0=min(value0,val);
}
}
else {
return P(INF,INF);
}
return P(value0,value1);
}
int main(void) {
scanf("%d",&n);
for(int i=1;i<=n;i++) {
scanf("%d",&arr[i]);
upd(i,1);
pq.push(P(abs(arr[i]),i));
}
int sz=n;
long long ret0=0;
long long ret1=INF;
while (!pq.empty()) {
int now=pq.top().first;
if (now==0) {
break;
}
vector<int> vec;
while (!pq.empty()&&pq.top().first==now) {
vec.push_back(pq.top().second);
pq.pop();
}
long long value=INF;
sort(vec.begin(),vec.end());
vector<int> vec0; //1에서 양수
vector<int> vec1; //1에서 음수
for(int i=0;i<vec.size();i++) {
if ((vec[i]%2==1)^(arr[vec[i]]<0)) {
vec0.push_back(vec[i]);
//printf(".0 %d\n",vec[i]);
}
else {
vec1.push_back(vec[i]);
//printf(".1 %d\n",vec[i]);
}
}
P even=solve(vec0,vec1,sz);
for(int i=0;i<vec.size();i++) {
if (sum(vec[i])-sum(vec[i]-1)==0) {
upd(vec[i],1);
}
}
P odd=solve(vec1,vec0,sz);
for(int i=0;i<vec.size();i++) {
if (sum(vec[i])-sum(vec[i]-1)==1) {
upd(vec[i],-1);
}
}
//printf("%lld %lld %lld %lld\n",even.first,even.second,odd.first,odd.second);
long long save0=ret0;
long long save1=ret1;
ret0=min(save1+odd.second,save0+even.first);
ret1=min(save1+odd.first,save0+even.second);
//printf("..%lld %lld\n",ret0,ret1);
if (ret0>=INF&&ret1>=INF) {
printf("-1");
return 0;
}
sz-=vec.size();
}
if (ret0>=INF&&ret1>=INF) {
printf("-1");
return 0;
}
printf("%lld",min(ret0,ret1));
return 0;
}
Compilation message
Main.cpp: In function 'P solve(std::vector<int>, std::vector<int>, int)':
Main.cpp:27:14: warning: unused variable 'stone' [-Wunused-variable]
27 | bool stone=true;
| ^~~~~
Main.cpp: In function 'int main()':
Main.cpp:199:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
199 | for(int i=0;i<vec.size();i++) {
| ~^~~~~~~~~~~
Main.cpp:210:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
210 | for(int i=0;i<vec.size();i++) {
| ~^~~~~~~~~~~
Main.cpp:216:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
216 | for(int i=0;i<vec.size();i++) {
| ~^~~~~~~~~~~
Main.cpp:195:19: warning: unused variable 'value' [-Wunused-variable]
195 | long long value=INF;
| ^~~~~
Main.cpp:176:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
176 | scanf("%d",&n);
| ~~~~~^~~~~~~~~
Main.cpp:178:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
178 | scanf("%d",&arr[i]);
| ~~~~~^~~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
10 |
Correct |
1 ms |
340 KB |
Output is correct |
11 |
Correct |
1 ms |
340 KB |
Output is correct |
12 |
Correct |
1 ms |
392 KB |
Output is correct |
13 |
Correct |
1 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
10 |
Correct |
1 ms |
340 KB |
Output is correct |
11 |
Correct |
1 ms |
340 KB |
Output is correct |
12 |
Correct |
1 ms |
392 KB |
Output is correct |
13 |
Correct |
1 ms |
340 KB |
Output is correct |
14 |
Correct |
0 ms |
312 KB |
Output is correct |
15 |
Correct |
143 ms |
18780 KB |
Output is correct |
16 |
Correct |
150 ms |
18208 KB |
Output is correct |
17 |
Correct |
144 ms |
18152 KB |
Output is correct |
18 |
Correct |
119 ms |
19312 KB |
Output is correct |
19 |
Correct |
171 ms |
19916 KB |
Output is correct |
20 |
Correct |
176 ms |
18520 KB |
Output is correct |
21 |
Correct |
174 ms |
19044 KB |
Output is correct |
22 |
Correct |
173 ms |
18972 KB |
Output is correct |
23 |
Correct |
180 ms |
18116 KB |
Output is correct |
24 |
Correct |
134 ms |
19076 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
10 |
Correct |
1 ms |
340 KB |
Output is correct |
11 |
Correct |
1 ms |
340 KB |
Output is correct |
12 |
Correct |
1 ms |
392 KB |
Output is correct |
13 |
Correct |
1 ms |
340 KB |
Output is correct |
14 |
Correct |
0 ms |
212 KB |
Output is correct |
15 |
Correct |
0 ms |
212 KB |
Output is correct |
16 |
Correct |
0 ms |
212 KB |
Output is correct |
17 |
Correct |
1 ms |
340 KB |
Output is correct |
18 |
Correct |
1 ms |
340 KB |
Output is correct |
19 |
Correct |
1 ms |
340 KB |
Output is correct |
20 |
Correct |
1 ms |
340 KB |
Output is correct |
21 |
Correct |
1 ms |
340 KB |
Output is correct |
22 |
Correct |
1 ms |
340 KB |
Output is correct |
23 |
Correct |
1 ms |
340 KB |
Output is correct |
24 |
Correct |
1 ms |
340 KB |
Output is correct |
25 |
Correct |
1 ms |
340 KB |
Output is correct |
26 |
Correct |
1 ms |
340 KB |
Output is correct |
27 |
Correct |
1 ms |
340 KB |
Output is correct |
28 |
Correct |
1 ms |
340 KB |
Output is correct |
29 |
Correct |
1 ms |
340 KB |
Output is correct |
30 |
Correct |
1 ms |
340 KB |
Output is correct |
31 |
Correct |
1 ms |
340 KB |
Output is correct |
32 |
Correct |
1 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
10 |
Correct |
1 ms |
340 KB |
Output is correct |
11 |
Correct |
1 ms |
340 KB |
Output is correct |
12 |
Correct |
1 ms |
392 KB |
Output is correct |
13 |
Correct |
1 ms |
340 KB |
Output is correct |
14 |
Correct |
0 ms |
312 KB |
Output is correct |
15 |
Correct |
143 ms |
18780 KB |
Output is correct |
16 |
Correct |
150 ms |
18208 KB |
Output is correct |
17 |
Correct |
144 ms |
18152 KB |
Output is correct |
18 |
Correct |
119 ms |
19312 KB |
Output is correct |
19 |
Correct |
171 ms |
19916 KB |
Output is correct |
20 |
Correct |
176 ms |
18520 KB |
Output is correct |
21 |
Correct |
174 ms |
19044 KB |
Output is correct |
22 |
Correct |
173 ms |
18972 KB |
Output is correct |
23 |
Correct |
180 ms |
18116 KB |
Output is correct |
24 |
Correct |
134 ms |
19076 KB |
Output is correct |
25 |
Correct |
0 ms |
212 KB |
Output is correct |
26 |
Correct |
0 ms |
212 KB |
Output is correct |
27 |
Correct |
0 ms |
212 KB |
Output is correct |
28 |
Correct |
1 ms |
340 KB |
Output is correct |
29 |
Correct |
1 ms |
340 KB |
Output is correct |
30 |
Correct |
1 ms |
340 KB |
Output is correct |
31 |
Correct |
1 ms |
340 KB |
Output is correct |
32 |
Correct |
1 ms |
340 KB |
Output is correct |
33 |
Correct |
1 ms |
340 KB |
Output is correct |
34 |
Correct |
1 ms |
340 KB |
Output is correct |
35 |
Correct |
1 ms |
340 KB |
Output is correct |
36 |
Correct |
1 ms |
340 KB |
Output is correct |
37 |
Correct |
1 ms |
340 KB |
Output is correct |
38 |
Correct |
1 ms |
340 KB |
Output is correct |
39 |
Correct |
1 ms |
340 KB |
Output is correct |
40 |
Correct |
1 ms |
340 KB |
Output is correct |
41 |
Correct |
1 ms |
340 KB |
Output is correct |
42 |
Correct |
1 ms |
340 KB |
Output is correct |
43 |
Correct |
1 ms |
340 KB |
Output is correct |
44 |
Correct |
110 ms |
15516 KB |
Output is correct |
45 |
Correct |
114 ms |
15472 KB |
Output is correct |
46 |
Correct |
107 ms |
15852 KB |
Output is correct |
47 |
Correct |
96 ms |
15836 KB |
Output is correct |
48 |
Correct |
136 ms |
17684 KB |
Output is correct |
49 |
Correct |
175 ms |
19108 KB |
Output is correct |
50 |
Correct |
117 ms |
15148 KB |
Output is correct |
51 |
Correct |
97 ms |
16036 KB |
Output is correct |
52 |
Correct |
96 ms |
15008 KB |
Output is correct |
53 |
Correct |
81 ms |
15992 KB |
Output is correct |
54 |
Correct |
126 ms |
16812 KB |
Output is correct |
55 |
Correct |
133 ms |
16768 KB |
Output is correct |
56 |
Correct |
132 ms |
17736 KB |
Output is correct |
57 |
Correct |
57 ms |
12320 KB |
Output is correct |
58 |
Correct |
59 ms |
12356 KB |
Output is correct |
59 |
Correct |
59 ms |
12840 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
2 ms |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
400 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
2 ms |
468 KB |
Output is correct |
9 |
Correct |
0 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
340 KB |
Output is correct |
12 |
Correct |
2 ms |
340 KB |
Output is correct |
13 |
Correct |
1 ms |
284 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
2 ms |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
400 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
2 ms |
468 KB |
Output is correct |
9 |
Correct |
0 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
340 KB |
Output is correct |
12 |
Correct |
2 ms |
340 KB |
Output is correct |
13 |
Correct |
1 ms |
284 KB |
Output is correct |
14 |
Correct |
100 ms |
14340 KB |
Output is correct |
15 |
Correct |
296 ms |
13988 KB |
Output is correct |
16 |
Correct |
314 ms |
13336 KB |
Output is correct |
17 |
Correct |
307 ms |
12324 KB |
Output is correct |
18 |
Correct |
301 ms |
13408 KB |
Output is correct |
19 |
Correct |
258 ms |
14496 KB |
Output is correct |
20 |
Correct |
1 ms |
212 KB |
Output is correct |
21 |
Correct |
0 ms |
212 KB |
Output is correct |
22 |
Correct |
218 ms |
14484 KB |
Output is correct |
23 |
Correct |
215 ms |
14244 KB |
Output is correct |
24 |
Correct |
186 ms |
13708 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
10 |
Correct |
1 ms |
340 KB |
Output is correct |
11 |
Correct |
1 ms |
340 KB |
Output is correct |
12 |
Correct |
1 ms |
392 KB |
Output is correct |
13 |
Correct |
1 ms |
340 KB |
Output is correct |
14 |
Correct |
0 ms |
212 KB |
Output is correct |
15 |
Correct |
0 ms |
212 KB |
Output is correct |
16 |
Correct |
0 ms |
212 KB |
Output is correct |
17 |
Correct |
1 ms |
340 KB |
Output is correct |
18 |
Correct |
1 ms |
340 KB |
Output is correct |
19 |
Correct |
1 ms |
340 KB |
Output is correct |
20 |
Correct |
1 ms |
340 KB |
Output is correct |
21 |
Correct |
1 ms |
340 KB |
Output is correct |
22 |
Correct |
1 ms |
340 KB |
Output is correct |
23 |
Correct |
1 ms |
340 KB |
Output is correct |
24 |
Correct |
1 ms |
340 KB |
Output is correct |
25 |
Correct |
1 ms |
340 KB |
Output is correct |
26 |
Correct |
1 ms |
340 KB |
Output is correct |
27 |
Correct |
1 ms |
340 KB |
Output is correct |
28 |
Correct |
1 ms |
340 KB |
Output is correct |
29 |
Correct |
1 ms |
340 KB |
Output is correct |
30 |
Correct |
1 ms |
340 KB |
Output is correct |
31 |
Correct |
1 ms |
340 KB |
Output is correct |
32 |
Correct |
1 ms |
340 KB |
Output is correct |
33 |
Correct |
0 ms |
212 KB |
Output is correct |
34 |
Correct |
1 ms |
212 KB |
Output is correct |
35 |
Correct |
1 ms |
340 KB |
Output is correct |
36 |
Correct |
2 ms |
340 KB |
Output is correct |
37 |
Correct |
1 ms |
340 KB |
Output is correct |
38 |
Correct |
1 ms |
400 KB |
Output is correct |
39 |
Correct |
1 ms |
340 KB |
Output is correct |
40 |
Correct |
2 ms |
468 KB |
Output is correct |
41 |
Correct |
0 ms |
212 KB |
Output is correct |
42 |
Correct |
1 ms |
212 KB |
Output is correct |
43 |
Correct |
1 ms |
340 KB |
Output is correct |
44 |
Correct |
2 ms |
340 KB |
Output is correct |
45 |
Correct |
1 ms |
284 KB |
Output is correct |
46 |
Correct |
2 ms |
340 KB |
Output is correct |
47 |
Correct |
2 ms |
356 KB |
Output is correct |
48 |
Correct |
2 ms |
340 KB |
Output is correct |
49 |
Correct |
2 ms |
340 KB |
Output is correct |
50 |
Correct |
1 ms |
340 KB |
Output is correct |
51 |
Correct |
1 ms |
340 KB |
Output is correct |
52 |
Correct |
1 ms |
340 KB |
Output is correct |
53 |
Correct |
1 ms |
396 KB |
Output is correct |
54 |
Correct |
1 ms |
340 KB |
Output is correct |
55 |
Correct |
1 ms |
368 KB |
Output is correct |
56 |
Correct |
0 ms |
212 KB |
Output is correct |
57 |
Correct |
0 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
10 |
Correct |
1 ms |
340 KB |
Output is correct |
11 |
Correct |
1 ms |
340 KB |
Output is correct |
12 |
Correct |
1 ms |
392 KB |
Output is correct |
13 |
Correct |
1 ms |
340 KB |
Output is correct |
14 |
Correct |
0 ms |
312 KB |
Output is correct |
15 |
Correct |
143 ms |
18780 KB |
Output is correct |
16 |
Correct |
150 ms |
18208 KB |
Output is correct |
17 |
Correct |
144 ms |
18152 KB |
Output is correct |
18 |
Correct |
119 ms |
19312 KB |
Output is correct |
19 |
Correct |
171 ms |
19916 KB |
Output is correct |
20 |
Correct |
176 ms |
18520 KB |
Output is correct |
21 |
Correct |
174 ms |
19044 KB |
Output is correct |
22 |
Correct |
173 ms |
18972 KB |
Output is correct |
23 |
Correct |
180 ms |
18116 KB |
Output is correct |
24 |
Correct |
134 ms |
19076 KB |
Output is correct |
25 |
Correct |
0 ms |
212 KB |
Output is correct |
26 |
Correct |
0 ms |
212 KB |
Output is correct |
27 |
Correct |
0 ms |
212 KB |
Output is correct |
28 |
Correct |
1 ms |
340 KB |
Output is correct |
29 |
Correct |
1 ms |
340 KB |
Output is correct |
30 |
Correct |
1 ms |
340 KB |
Output is correct |
31 |
Correct |
1 ms |
340 KB |
Output is correct |
32 |
Correct |
1 ms |
340 KB |
Output is correct |
33 |
Correct |
1 ms |
340 KB |
Output is correct |
34 |
Correct |
1 ms |
340 KB |
Output is correct |
35 |
Correct |
1 ms |
340 KB |
Output is correct |
36 |
Correct |
1 ms |
340 KB |
Output is correct |
37 |
Correct |
1 ms |
340 KB |
Output is correct |
38 |
Correct |
1 ms |
340 KB |
Output is correct |
39 |
Correct |
1 ms |
340 KB |
Output is correct |
40 |
Correct |
1 ms |
340 KB |
Output is correct |
41 |
Correct |
1 ms |
340 KB |
Output is correct |
42 |
Correct |
1 ms |
340 KB |
Output is correct |
43 |
Correct |
1 ms |
340 KB |
Output is correct |
44 |
Correct |
110 ms |
15516 KB |
Output is correct |
45 |
Correct |
114 ms |
15472 KB |
Output is correct |
46 |
Correct |
107 ms |
15852 KB |
Output is correct |
47 |
Correct |
96 ms |
15836 KB |
Output is correct |
48 |
Correct |
136 ms |
17684 KB |
Output is correct |
49 |
Correct |
175 ms |
19108 KB |
Output is correct |
50 |
Correct |
117 ms |
15148 KB |
Output is correct |
51 |
Correct |
97 ms |
16036 KB |
Output is correct |
52 |
Correct |
96 ms |
15008 KB |
Output is correct |
53 |
Correct |
81 ms |
15992 KB |
Output is correct |
54 |
Correct |
126 ms |
16812 KB |
Output is correct |
55 |
Correct |
133 ms |
16768 KB |
Output is correct |
56 |
Correct |
132 ms |
17736 KB |
Output is correct |
57 |
Correct |
57 ms |
12320 KB |
Output is correct |
58 |
Correct |
59 ms |
12356 KB |
Output is correct |
59 |
Correct |
59 ms |
12840 KB |
Output is correct |
60 |
Correct |
0 ms |
212 KB |
Output is correct |
61 |
Correct |
1 ms |
212 KB |
Output is correct |
62 |
Correct |
1 ms |
340 KB |
Output is correct |
63 |
Correct |
2 ms |
340 KB |
Output is correct |
64 |
Correct |
1 ms |
340 KB |
Output is correct |
65 |
Correct |
1 ms |
400 KB |
Output is correct |
66 |
Correct |
1 ms |
340 KB |
Output is correct |
67 |
Correct |
2 ms |
468 KB |
Output is correct |
68 |
Correct |
0 ms |
212 KB |
Output is correct |
69 |
Correct |
1 ms |
212 KB |
Output is correct |
70 |
Correct |
1 ms |
340 KB |
Output is correct |
71 |
Correct |
2 ms |
340 KB |
Output is correct |
72 |
Correct |
1 ms |
284 KB |
Output is correct |
73 |
Correct |
100 ms |
14340 KB |
Output is correct |
74 |
Correct |
296 ms |
13988 KB |
Output is correct |
75 |
Correct |
314 ms |
13336 KB |
Output is correct |
76 |
Correct |
307 ms |
12324 KB |
Output is correct |
77 |
Correct |
301 ms |
13408 KB |
Output is correct |
78 |
Correct |
258 ms |
14496 KB |
Output is correct |
79 |
Correct |
1 ms |
212 KB |
Output is correct |
80 |
Correct |
0 ms |
212 KB |
Output is correct |
81 |
Correct |
218 ms |
14484 KB |
Output is correct |
82 |
Correct |
215 ms |
14244 KB |
Output is correct |
83 |
Correct |
186 ms |
13708 KB |
Output is correct |
84 |
Correct |
2 ms |
340 KB |
Output is correct |
85 |
Correct |
2 ms |
356 KB |
Output is correct |
86 |
Correct |
2 ms |
340 KB |
Output is correct |
87 |
Correct |
2 ms |
340 KB |
Output is correct |
88 |
Correct |
1 ms |
340 KB |
Output is correct |
89 |
Correct |
1 ms |
340 KB |
Output is correct |
90 |
Correct |
1 ms |
340 KB |
Output is correct |
91 |
Correct |
1 ms |
396 KB |
Output is correct |
92 |
Correct |
1 ms |
340 KB |
Output is correct |
93 |
Correct |
1 ms |
368 KB |
Output is correct |
94 |
Correct |
0 ms |
212 KB |
Output is correct |
95 |
Correct |
0 ms |
212 KB |
Output is correct |
96 |
Correct |
148 ms |
15036 KB |
Output is correct |
97 |
Correct |
146 ms |
15416 KB |
Output is correct |
98 |
Correct |
135 ms |
15380 KB |
Output is correct |
99 |
Correct |
217 ms |
13664 KB |
Output is correct |
100 |
Correct |
161 ms |
17528 KB |
Output is correct |
101 |
Correct |
123 ms |
13740 KB |
Output is correct |
102 |
Correct |
273 ms |
13344 KB |
Output is correct |
103 |
Correct |
314 ms |
13388 KB |
Output is correct |
104 |
Correct |
262 ms |
13372 KB |
Output is correct |
105 |
Correct |
228 ms |
12568 KB |
Output is correct |
106 |
Correct |
198 ms |
13044 KB |
Output is correct |