#include<bits/stdc++.h>
#include "minerals.h"
using namespace std;
int nbCartes;
vector<int> groupeDeb1,groupeDeb2;
void calc(vector<int> gp1,vector<int> gp2,int mis1) {
/*for (int i:gp1) {
cout<<i<<" ";
}
cout<<" ";
for (int i:gp2) {
cout<<i<<" ";
}
cout<<endl;*/
if (gp1.size()==1) {
Answer(gp1[0],gp2[0]);
return;
}
int dernRep=0,ans,mid;
vector<int> nouvDeb1,nouvDeb2,nouvFin1,nouvFin2;
if (gp1.size()<6) {
mid=(gp1.size()+mis1)/2;
}
else {
if (mis1==0) {
mid=3849*gp1.size()/10000;
}
else {
mid=6167*gp1.size()/10000;
}
}
for (int i=0;i<mid;i++) {
nouvDeb1.push_back(gp1[i]);
}
for (int i=mid;i<(int)gp1.size();i++) {
nouvFin1.push_back(gp1[i]);
}
if (mis1==0) {
for (int i:nouvDeb1) {
dernRep=Query(i);
}
}
else {
for (int i:nouvFin1) {
dernRep=Query(i);
}
}
for (int i:gp2) {
if (i!=gp2.back()) {
ans=Query(i);
if (ans==dernRep) {
nouvDeb2.push_back(i);
}
else {
nouvFin2.push_back(i);
}
dernRep=ans;
}
else {
if (nouvDeb2.size()==mid) {
nouvFin2.push_back(i);
}
else {
nouvDeb2.push_back(i);
}
}
}
calc(nouvDeb1,nouvDeb2,1);
calc(nouvFin1,nouvFin2,0);
}
void Solve(int N) {
nbCartes=N;
int anci=0,ans;
for (int i=1;i<=2*nbCartes;i++) {
ans=Query(i);
if (ans>anci) {
groupeDeb1.push_back(i);
}
else {
groupeDeb2.push_back(i);
}
anci=ans;
}
calc(groupeDeb1,groupeDeb2,1);
}
Compilation message
minerals.cpp: In function 'void calc(std::vector<int>, std::vector<int>, int)':
minerals.cpp:64:32: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
64 | if (nouvDeb2.size()==mid) {
| ~~~~~~~~~~~~~~~^~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Output is correct |
2 |
Correct |
1 ms |
248 KB |
Output is correct |
3 |
Correct |
1 ms |
216 KB |
Output is correct |
4 |
Correct |
0 ms |
208 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
2 ms |
464 KB |
Output is correct |
3 |
Correct |
3 ms |
592 KB |
Output is correct |
4 |
Correct |
6 ms |
940 KB |
Output is correct |
5 |
Correct |
10 ms |
1540 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Output is correct |
2 |
Correct |
1 ms |
248 KB |
Output is correct |
3 |
Correct |
1 ms |
216 KB |
Output is correct |
4 |
Correct |
0 ms |
208 KB |
Output is correct |
5 |
Correct |
1 ms |
336 KB |
Output is correct |
6 |
Correct |
2 ms |
464 KB |
Output is correct |
7 |
Correct |
3 ms |
592 KB |
Output is correct |
8 |
Correct |
6 ms |
940 KB |
Output is correct |
9 |
Correct |
10 ms |
1540 KB |
Output is correct |
10 |
Correct |
1 ms |
336 KB |
Output is correct |
11 |
Correct |
8 ms |
1232 KB |
Output is correct |
12 |
Correct |
10 ms |
1616 KB |
Output is correct |
13 |
Correct |
12 ms |
1616 KB |
Output is correct |
14 |
Correct |
9 ms |
1488 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Output is correct |
2 |
Correct |
1 ms |
248 KB |
Output is correct |
3 |
Correct |
1 ms |
216 KB |
Output is correct |
4 |
Correct |
0 ms |
208 KB |
Output is correct |
5 |
Correct |
1 ms |
336 KB |
Output is correct |
6 |
Correct |
2 ms |
464 KB |
Output is correct |
7 |
Correct |
3 ms |
592 KB |
Output is correct |
8 |
Correct |
6 ms |
940 KB |
Output is correct |
9 |
Correct |
10 ms |
1540 KB |
Output is correct |
10 |
Correct |
1 ms |
336 KB |
Output is correct |
11 |
Correct |
8 ms |
1232 KB |
Output is correct |
12 |
Correct |
10 ms |
1616 KB |
Output is correct |
13 |
Correct |
12 ms |
1616 KB |
Output is correct |
14 |
Correct |
9 ms |
1488 KB |
Output is correct |
15 |
Correct |
29 ms |
3544 KB |
Output is correct |
16 |
Correct |
28 ms |
3500 KB |
Output is correct |
17 |
Correct |
27 ms |
3456 KB |
Output is correct |
18 |
Correct |
27 ms |
3344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Output is correct |
2 |
Correct |
1 ms |
248 KB |
Output is correct |
3 |
Correct |
1 ms |
216 KB |
Output is correct |
4 |
Correct |
0 ms |
208 KB |
Output is correct |
5 |
Correct |
1 ms |
336 KB |
Output is correct |
6 |
Correct |
2 ms |
464 KB |
Output is correct |
7 |
Correct |
3 ms |
592 KB |
Output is correct |
8 |
Correct |
6 ms |
940 KB |
Output is correct |
9 |
Correct |
10 ms |
1540 KB |
Output is correct |
10 |
Correct |
1 ms |
336 KB |
Output is correct |
11 |
Correct |
8 ms |
1232 KB |
Output is correct |
12 |
Correct |
10 ms |
1616 KB |
Output is correct |
13 |
Correct |
12 ms |
1616 KB |
Output is correct |
14 |
Correct |
9 ms |
1488 KB |
Output is correct |
15 |
Correct |
29 ms |
3544 KB |
Output is correct |
16 |
Correct |
28 ms |
3500 KB |
Output is correct |
17 |
Correct |
27 ms |
3456 KB |
Output is correct |
18 |
Correct |
27 ms |
3344 KB |
Output is correct |
19 |
Correct |
33 ms |
3536 KB |
Output is correct |
20 |
Correct |
28 ms |
3604 KB |
Output is correct |
21 |
Correct |
27 ms |
3568 KB |
Output is correct |
22 |
Correct |
27 ms |
3476 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Output is correct |
2 |
Correct |
1 ms |
248 KB |
Output is correct |
3 |
Correct |
1 ms |
216 KB |
Output is correct |
4 |
Correct |
0 ms |
208 KB |
Output is correct |
5 |
Correct |
1 ms |
336 KB |
Output is correct |
6 |
Correct |
2 ms |
464 KB |
Output is correct |
7 |
Correct |
3 ms |
592 KB |
Output is correct |
8 |
Correct |
6 ms |
940 KB |
Output is correct |
9 |
Correct |
10 ms |
1540 KB |
Output is correct |
10 |
Correct |
1 ms |
336 KB |
Output is correct |
11 |
Correct |
8 ms |
1232 KB |
Output is correct |
12 |
Correct |
10 ms |
1616 KB |
Output is correct |
13 |
Correct |
12 ms |
1616 KB |
Output is correct |
14 |
Correct |
9 ms |
1488 KB |
Output is correct |
15 |
Correct |
29 ms |
3544 KB |
Output is correct |
16 |
Correct |
28 ms |
3500 KB |
Output is correct |
17 |
Correct |
27 ms |
3456 KB |
Output is correct |
18 |
Correct |
27 ms |
3344 KB |
Output is correct |
19 |
Correct |
33 ms |
3536 KB |
Output is correct |
20 |
Correct |
28 ms |
3604 KB |
Output is correct |
21 |
Correct |
27 ms |
3568 KB |
Output is correct |
22 |
Correct |
27 ms |
3476 KB |
Output is correct |
23 |
Correct |
29 ms |
3716 KB |
Output is correct |
24 |
Correct |
29 ms |
3652 KB |
Output is correct |
25 |
Correct |
24 ms |
3696 KB |
Output is correct |
26 |
Correct |
25 ms |
3464 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Output is correct |
2 |
Correct |
1 ms |
248 KB |
Output is correct |
3 |
Correct |
1 ms |
216 KB |
Output is correct |
4 |
Correct |
0 ms |
208 KB |
Output is correct |
5 |
Correct |
1 ms |
336 KB |
Output is correct |
6 |
Correct |
2 ms |
464 KB |
Output is correct |
7 |
Correct |
3 ms |
592 KB |
Output is correct |
8 |
Correct |
6 ms |
940 KB |
Output is correct |
9 |
Correct |
10 ms |
1540 KB |
Output is correct |
10 |
Correct |
1 ms |
336 KB |
Output is correct |
11 |
Correct |
8 ms |
1232 KB |
Output is correct |
12 |
Correct |
10 ms |
1616 KB |
Output is correct |
13 |
Correct |
12 ms |
1616 KB |
Output is correct |
14 |
Correct |
9 ms |
1488 KB |
Output is correct |
15 |
Correct |
29 ms |
3544 KB |
Output is correct |
16 |
Correct |
28 ms |
3500 KB |
Output is correct |
17 |
Correct |
27 ms |
3456 KB |
Output is correct |
18 |
Correct |
27 ms |
3344 KB |
Output is correct |
19 |
Correct |
33 ms |
3536 KB |
Output is correct |
20 |
Correct |
28 ms |
3604 KB |
Output is correct |
21 |
Correct |
27 ms |
3568 KB |
Output is correct |
22 |
Correct |
27 ms |
3476 KB |
Output is correct |
23 |
Correct |
29 ms |
3716 KB |
Output is correct |
24 |
Correct |
29 ms |
3652 KB |
Output is correct |
25 |
Correct |
24 ms |
3696 KB |
Output is correct |
26 |
Correct |
25 ms |
3464 KB |
Output is correct |
27 |
Correct |
31 ms |
3672 KB |
Output is correct |
28 |
Correct |
29 ms |
3744 KB |
Output is correct |
29 |
Correct |
24 ms |
3740 KB |
Output is correct |
30 |
Correct |
27 ms |
3676 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Output is correct |
2 |
Correct |
1 ms |
248 KB |
Output is correct |
3 |
Correct |
1 ms |
216 KB |
Output is correct |
4 |
Correct |
0 ms |
208 KB |
Output is correct |
5 |
Correct |
1 ms |
336 KB |
Output is correct |
6 |
Correct |
2 ms |
464 KB |
Output is correct |
7 |
Correct |
3 ms |
592 KB |
Output is correct |
8 |
Correct |
6 ms |
940 KB |
Output is correct |
9 |
Correct |
10 ms |
1540 KB |
Output is correct |
10 |
Correct |
1 ms |
336 KB |
Output is correct |
11 |
Correct |
8 ms |
1232 KB |
Output is correct |
12 |
Correct |
10 ms |
1616 KB |
Output is correct |
13 |
Correct |
12 ms |
1616 KB |
Output is correct |
14 |
Correct |
9 ms |
1488 KB |
Output is correct |
15 |
Correct |
29 ms |
3544 KB |
Output is correct |
16 |
Correct |
28 ms |
3500 KB |
Output is correct |
17 |
Correct |
27 ms |
3456 KB |
Output is correct |
18 |
Correct |
27 ms |
3344 KB |
Output is correct |
19 |
Correct |
33 ms |
3536 KB |
Output is correct |
20 |
Correct |
28 ms |
3604 KB |
Output is correct |
21 |
Correct |
27 ms |
3568 KB |
Output is correct |
22 |
Correct |
27 ms |
3476 KB |
Output is correct |
23 |
Correct |
29 ms |
3716 KB |
Output is correct |
24 |
Correct |
29 ms |
3652 KB |
Output is correct |
25 |
Correct |
24 ms |
3696 KB |
Output is correct |
26 |
Correct |
25 ms |
3464 KB |
Output is correct |
27 |
Correct |
31 ms |
3672 KB |
Output is correct |
28 |
Correct |
29 ms |
3744 KB |
Output is correct |
29 |
Correct |
24 ms |
3740 KB |
Output is correct |
30 |
Correct |
27 ms |
3676 KB |
Output is correct |
31 |
Correct |
30 ms |
3796 KB |
Output is correct |
32 |
Correct |
35 ms |
3776 KB |
Output is correct |
33 |
Correct |
34 ms |
3720 KB |
Output is correct |
34 |
Correct |
32 ms |
3624 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Output is correct |
2 |
Correct |
1 ms |
248 KB |
Output is correct |
3 |
Correct |
1 ms |
216 KB |
Output is correct |
4 |
Correct |
0 ms |
208 KB |
Output is correct |
5 |
Correct |
1 ms |
336 KB |
Output is correct |
6 |
Correct |
2 ms |
464 KB |
Output is correct |
7 |
Correct |
3 ms |
592 KB |
Output is correct |
8 |
Correct |
6 ms |
940 KB |
Output is correct |
9 |
Correct |
10 ms |
1540 KB |
Output is correct |
10 |
Correct |
1 ms |
336 KB |
Output is correct |
11 |
Correct |
8 ms |
1232 KB |
Output is correct |
12 |
Correct |
10 ms |
1616 KB |
Output is correct |
13 |
Correct |
12 ms |
1616 KB |
Output is correct |
14 |
Correct |
9 ms |
1488 KB |
Output is correct |
15 |
Correct |
29 ms |
3544 KB |
Output is correct |
16 |
Correct |
28 ms |
3500 KB |
Output is correct |
17 |
Correct |
27 ms |
3456 KB |
Output is correct |
18 |
Correct |
27 ms |
3344 KB |
Output is correct |
19 |
Correct |
33 ms |
3536 KB |
Output is correct |
20 |
Correct |
28 ms |
3604 KB |
Output is correct |
21 |
Correct |
27 ms |
3568 KB |
Output is correct |
22 |
Correct |
27 ms |
3476 KB |
Output is correct |
23 |
Correct |
29 ms |
3716 KB |
Output is correct |
24 |
Correct |
29 ms |
3652 KB |
Output is correct |
25 |
Correct |
24 ms |
3696 KB |
Output is correct |
26 |
Correct |
25 ms |
3464 KB |
Output is correct |
27 |
Correct |
31 ms |
3672 KB |
Output is correct |
28 |
Correct |
29 ms |
3744 KB |
Output is correct |
29 |
Correct |
24 ms |
3740 KB |
Output is correct |
30 |
Correct |
27 ms |
3676 KB |
Output is correct |
31 |
Correct |
30 ms |
3796 KB |
Output is correct |
32 |
Correct |
35 ms |
3776 KB |
Output is correct |
33 |
Correct |
34 ms |
3720 KB |
Output is correct |
34 |
Correct |
32 ms |
3624 KB |
Output is correct |
35 |
Correct |
31 ms |
3836 KB |
Output is correct |
36 |
Correct |
31 ms |
3792 KB |
Output is correct |
37 |
Correct |
30 ms |
3804 KB |
Output is correct |
38 |
Correct |
26 ms |
3656 KB |
Output is correct |