#include "minerals.h"
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
mt19937 mt(197797777);
int tmp=0;
bool query(int x)
{
int rr=Query(x);
bool ok;
if (rr!=tmp)
{
ok=false;
}
else ok=true;
tmp=rr;
return ok;
}
void solve(vector <int> left,vector <int> right,bool check)
{
if (left.empty())
{
return;
}
if (left.size()==1&&right.size()==1)
{
//cerr<<left[0]<<" "<<right[0]<<" ok"<<endl;
Answer(left[0],right[0]);
return;
}
int mid=int(left.size()*0.36)+1;
//cerr<<left.size()<<" "<<right.size()<<endl;
shuffle (left.begin(),left.end(),mt);
shuffle (right.begin(),right.end(),mt);
if (check==1)
{
mid=left.size()-mid;
for (int i=mid;i<=left.size()-1;i++)
{
query(left[i]);
}
}
else
{
for (int i=0;i<mid;i++)
{
query(left[i]);
}
}
vector<int> lefta,leftb,righta,rightb;
for (auto v:right)
{
if (righta.size()==mid)
{
rightb.pb(v);
}
else if (rightb.size()==right.size()-mid)
{
righta.pb(v);
}
else if (query(v)==true)
{
righta.pb(v);
}
else rightb.pb(v);
}
for (int i=0;i<mid;i++)
{
lefta.pb(left[i]);
}
for (int i=mid;i<left.size();i++)
{
leftb.pb(left[i]);
}
solve(lefta,righta,1);
solve(leftb,rightb,0);
}
void Solve(int n)
{
vector <int > opt;
vector <int> left,right;
for (int i=1;i<=2*n;i++)
{
if (query(i)==false)
{
left.pb(i);
}
else right.pb(i);
}
solve(left,right,1);
}
Compilation message
minerals.cpp: In function 'void solve(std::vector<int>, std::vector<int>, bool)':
minerals.cpp:40:25: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
40 | for (int i=mid;i<=left.size()-1;i++)
| ~^~~~~~~~~~~~~~~
minerals.cpp:55:26: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
55 | if (righta.size()==mid)
| ~~~~~~~~~~~~~^~~~~
minerals.cpp:73:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
73 | for (int i=mid;i<left.size();i++)
| ~^~~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
344 KB |
Output is correct |
3 |
Correct |
1 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
2 ms |
600 KB |
Output is correct |
3 |
Correct |
4 ms |
600 KB |
Output is correct |
4 |
Correct |
9 ms |
1112 KB |
Output is correct |
5 |
Correct |
18 ms |
1736 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
344 KB |
Output is correct |
3 |
Correct |
1 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
1 ms |
344 KB |
Output is correct |
6 |
Correct |
2 ms |
600 KB |
Output is correct |
7 |
Correct |
4 ms |
600 KB |
Output is correct |
8 |
Correct |
9 ms |
1112 KB |
Output is correct |
9 |
Correct |
18 ms |
1736 KB |
Output is correct |
10 |
Correct |
1 ms |
344 KB |
Output is correct |
11 |
Correct |
11 ms |
1360 KB |
Output is correct |
12 |
Correct |
16 ms |
1624 KB |
Output is correct |
13 |
Correct |
24 ms |
1624 KB |
Output is correct |
14 |
Correct |
21 ms |
1744 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
344 KB |
Output is correct |
3 |
Correct |
1 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
1 ms |
344 KB |
Output is correct |
6 |
Correct |
2 ms |
600 KB |
Output is correct |
7 |
Correct |
4 ms |
600 KB |
Output is correct |
8 |
Correct |
9 ms |
1112 KB |
Output is correct |
9 |
Correct |
18 ms |
1736 KB |
Output is correct |
10 |
Correct |
1 ms |
344 KB |
Output is correct |
11 |
Correct |
11 ms |
1360 KB |
Output is correct |
12 |
Correct |
16 ms |
1624 KB |
Output is correct |
13 |
Correct |
24 ms |
1624 KB |
Output is correct |
14 |
Correct |
21 ms |
1744 KB |
Output is correct |
15 |
Correct |
44 ms |
3664 KB |
Output is correct |
16 |
Correct |
49 ms |
3552 KB |
Output is correct |
17 |
Correct |
45 ms |
3892 KB |
Output is correct |
18 |
Correct |
48 ms |
3472 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
344 KB |
Output is correct |
3 |
Correct |
1 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
1 ms |
344 KB |
Output is correct |
6 |
Correct |
2 ms |
600 KB |
Output is correct |
7 |
Correct |
4 ms |
600 KB |
Output is correct |
8 |
Correct |
9 ms |
1112 KB |
Output is correct |
9 |
Correct |
18 ms |
1736 KB |
Output is correct |
10 |
Correct |
1 ms |
344 KB |
Output is correct |
11 |
Correct |
11 ms |
1360 KB |
Output is correct |
12 |
Correct |
16 ms |
1624 KB |
Output is correct |
13 |
Correct |
24 ms |
1624 KB |
Output is correct |
14 |
Correct |
21 ms |
1744 KB |
Output is correct |
15 |
Correct |
44 ms |
3664 KB |
Output is correct |
16 |
Correct |
49 ms |
3552 KB |
Output is correct |
17 |
Correct |
45 ms |
3892 KB |
Output is correct |
18 |
Correct |
48 ms |
3472 KB |
Output is correct |
19 |
Correct |
46 ms |
3672 KB |
Output is correct |
20 |
Correct |
53 ms |
3812 KB |
Output is correct |
21 |
Correct |
46 ms |
3628 KB |
Output is correct |
22 |
Correct |
47 ms |
3916 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
344 KB |
Output is correct |
3 |
Correct |
1 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
1 ms |
344 KB |
Output is correct |
6 |
Correct |
2 ms |
600 KB |
Output is correct |
7 |
Correct |
4 ms |
600 KB |
Output is correct |
8 |
Correct |
9 ms |
1112 KB |
Output is correct |
9 |
Correct |
18 ms |
1736 KB |
Output is correct |
10 |
Correct |
1 ms |
344 KB |
Output is correct |
11 |
Correct |
11 ms |
1360 KB |
Output is correct |
12 |
Correct |
16 ms |
1624 KB |
Output is correct |
13 |
Correct |
24 ms |
1624 KB |
Output is correct |
14 |
Correct |
21 ms |
1744 KB |
Output is correct |
15 |
Correct |
44 ms |
3664 KB |
Output is correct |
16 |
Correct |
49 ms |
3552 KB |
Output is correct |
17 |
Correct |
45 ms |
3892 KB |
Output is correct |
18 |
Correct |
48 ms |
3472 KB |
Output is correct |
19 |
Correct |
46 ms |
3672 KB |
Output is correct |
20 |
Correct |
53 ms |
3812 KB |
Output is correct |
21 |
Correct |
46 ms |
3628 KB |
Output is correct |
22 |
Correct |
47 ms |
3916 KB |
Output is correct |
23 |
Correct |
52 ms |
3812 KB |
Output is correct |
24 |
Correct |
54 ms |
3948 KB |
Output is correct |
25 |
Correct |
48 ms |
3940 KB |
Output is correct |
26 |
Correct |
49 ms |
3752 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
344 KB |
Output is correct |
3 |
Correct |
1 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
1 ms |
344 KB |
Output is correct |
6 |
Correct |
2 ms |
600 KB |
Output is correct |
7 |
Correct |
4 ms |
600 KB |
Output is correct |
8 |
Correct |
9 ms |
1112 KB |
Output is correct |
9 |
Correct |
18 ms |
1736 KB |
Output is correct |
10 |
Correct |
1 ms |
344 KB |
Output is correct |
11 |
Correct |
11 ms |
1360 KB |
Output is correct |
12 |
Correct |
16 ms |
1624 KB |
Output is correct |
13 |
Correct |
24 ms |
1624 KB |
Output is correct |
14 |
Correct |
21 ms |
1744 KB |
Output is correct |
15 |
Correct |
44 ms |
3664 KB |
Output is correct |
16 |
Correct |
49 ms |
3552 KB |
Output is correct |
17 |
Correct |
45 ms |
3892 KB |
Output is correct |
18 |
Correct |
48 ms |
3472 KB |
Output is correct |
19 |
Correct |
46 ms |
3672 KB |
Output is correct |
20 |
Correct |
53 ms |
3812 KB |
Output is correct |
21 |
Correct |
46 ms |
3628 KB |
Output is correct |
22 |
Correct |
47 ms |
3916 KB |
Output is correct |
23 |
Correct |
52 ms |
3812 KB |
Output is correct |
24 |
Correct |
54 ms |
3948 KB |
Output is correct |
25 |
Correct |
48 ms |
3940 KB |
Output is correct |
26 |
Correct |
49 ms |
3752 KB |
Output is correct |
27 |
Correct |
55 ms |
4128 KB |
Output is correct |
28 |
Correct |
55 ms |
4248 KB |
Output is correct |
29 |
Correct |
51 ms |
4240 KB |
Output is correct |
30 |
Correct |
53 ms |
4152 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
344 KB |
Output is correct |
3 |
Correct |
1 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
1 ms |
344 KB |
Output is correct |
6 |
Correct |
2 ms |
600 KB |
Output is correct |
7 |
Correct |
4 ms |
600 KB |
Output is correct |
8 |
Correct |
9 ms |
1112 KB |
Output is correct |
9 |
Correct |
18 ms |
1736 KB |
Output is correct |
10 |
Correct |
1 ms |
344 KB |
Output is correct |
11 |
Correct |
11 ms |
1360 KB |
Output is correct |
12 |
Correct |
16 ms |
1624 KB |
Output is correct |
13 |
Correct |
24 ms |
1624 KB |
Output is correct |
14 |
Correct |
21 ms |
1744 KB |
Output is correct |
15 |
Correct |
44 ms |
3664 KB |
Output is correct |
16 |
Correct |
49 ms |
3552 KB |
Output is correct |
17 |
Correct |
45 ms |
3892 KB |
Output is correct |
18 |
Correct |
48 ms |
3472 KB |
Output is correct |
19 |
Correct |
46 ms |
3672 KB |
Output is correct |
20 |
Correct |
53 ms |
3812 KB |
Output is correct |
21 |
Correct |
46 ms |
3628 KB |
Output is correct |
22 |
Correct |
47 ms |
3916 KB |
Output is correct |
23 |
Correct |
52 ms |
3812 KB |
Output is correct |
24 |
Correct |
54 ms |
3948 KB |
Output is correct |
25 |
Correct |
48 ms |
3940 KB |
Output is correct |
26 |
Correct |
49 ms |
3752 KB |
Output is correct |
27 |
Correct |
55 ms |
4128 KB |
Output is correct |
28 |
Correct |
55 ms |
4248 KB |
Output is correct |
29 |
Correct |
51 ms |
4240 KB |
Output is correct |
30 |
Correct |
53 ms |
4152 KB |
Output is correct |
31 |
Correct |
57 ms |
4096 KB |
Output is correct |
32 |
Correct |
59 ms |
4068 KB |
Output is correct |
33 |
Correct |
52 ms |
4072 KB |
Output is correct |
34 |
Correct |
53 ms |
4016 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
344 KB |
Output is correct |
3 |
Correct |
1 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
1 ms |
344 KB |
Output is correct |
6 |
Correct |
2 ms |
600 KB |
Output is correct |
7 |
Correct |
4 ms |
600 KB |
Output is correct |
8 |
Correct |
9 ms |
1112 KB |
Output is correct |
9 |
Correct |
18 ms |
1736 KB |
Output is correct |
10 |
Correct |
1 ms |
344 KB |
Output is correct |
11 |
Correct |
11 ms |
1360 KB |
Output is correct |
12 |
Correct |
16 ms |
1624 KB |
Output is correct |
13 |
Correct |
24 ms |
1624 KB |
Output is correct |
14 |
Correct |
21 ms |
1744 KB |
Output is correct |
15 |
Correct |
44 ms |
3664 KB |
Output is correct |
16 |
Correct |
49 ms |
3552 KB |
Output is correct |
17 |
Correct |
45 ms |
3892 KB |
Output is correct |
18 |
Correct |
48 ms |
3472 KB |
Output is correct |
19 |
Correct |
46 ms |
3672 KB |
Output is correct |
20 |
Correct |
53 ms |
3812 KB |
Output is correct |
21 |
Correct |
46 ms |
3628 KB |
Output is correct |
22 |
Correct |
47 ms |
3916 KB |
Output is correct |
23 |
Correct |
52 ms |
3812 KB |
Output is correct |
24 |
Correct |
54 ms |
3948 KB |
Output is correct |
25 |
Correct |
48 ms |
3940 KB |
Output is correct |
26 |
Correct |
49 ms |
3752 KB |
Output is correct |
27 |
Correct |
55 ms |
4128 KB |
Output is correct |
28 |
Correct |
55 ms |
4248 KB |
Output is correct |
29 |
Correct |
51 ms |
4240 KB |
Output is correct |
30 |
Correct |
53 ms |
4152 KB |
Output is correct |
31 |
Correct |
57 ms |
4096 KB |
Output is correct |
32 |
Correct |
59 ms |
4068 KB |
Output is correct |
33 |
Correct |
52 ms |
4072 KB |
Output is correct |
34 |
Correct |
53 ms |
4016 KB |
Output is correct |
35 |
Correct |
57 ms |
4176 KB |
Output is correct |
36 |
Correct |
54 ms |
4020 KB |
Output is correct |
37 |
Correct |
56 ms |
4176 KB |
Output is correct |
38 |
Correct |
56 ms |
4204 KB |
Output is correct |