#include "minerals.h"
#include <bits/stdc++.h>
using namespace std;
int query(int x)
{
return Query(x);
}
mt19937 mt(19779777);
void solve(vector <int> need,bool check)
{
if (need.size()==2)
{
if (check==1)
{
int aa=query(need[0]);
int bb=query(need[1]);
}
Answer(need[0],need[1]);
return;
}
if (need.size()<=1)
{
assert(1==0);
}
shuffle (need.begin(),need.end(),mt);
vector <int> aa,bb;
int rr=need.size()/4;
if (check==0)
{
for (int i=0;i<need.size();i++)
{
if (aa.size()==2*rr)
{
bb.push_back(need[i]);
continue;
}
int a1=query(need[i]);
//cout<<a1<<'\n';
if (a1<=rr)
{
aa.push_back(need[i]);
}
else
{
int a2=query(need[i]);
bb.push_back(need[i]);
}
}
solve(aa,1);
solve(bb,0);
}
else
{
for (int i=rr;i<need.size();i++)
{
int a1=query(need[i]);
}
for (int i=0;i<rr;i++)
{
aa.push_back(need[i]);
}
for (int i=rr;i<need.size();i++)
{
if (aa.size()==2*rr)
{
bb.push_back(need[i]);
continue;
}
int a1=query(need[i]);
if (a1<=rr)
{
aa.push_back(need[i]);
}
else
{
int a2=query(need[i]);
bb.push_back(need[i]);
}
}
solve(aa,1);
solve(bb,0);
}
}
void Solve(int n)
{
vector <int > opt;
for (int i=1;i<=2*n;i++)
{
opt.push_back(i);
}
solve(opt,0);
}
Compilation message
minerals.cpp: In function 'void solve(std::vector<int>, bool)':
minerals.cpp:16:17: warning: unused variable 'aa' [-Wunused-variable]
16 | int aa=query(need[0]);
| ^~
minerals.cpp:17:17: warning: unused variable 'bb' [-Wunused-variable]
17 | int bb=query(need[1]);
| ^~
minerals.cpp:31:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
31 | for (int i=0;i<need.size();i++)
| ~^~~~~~~~~~~~
minerals.cpp:33:26: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
33 | if (aa.size()==2*rr)
| ~~~~~~~~~^~~~~~
minerals.cpp:46:21: warning: unused variable 'a2' [-Wunused-variable]
46 | int a2=query(need[i]);
| ^~
minerals.cpp:55:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
55 | for (int i=rr;i<need.size();i++)
| ~^~~~~~~~~~~~
minerals.cpp:57:17: warning: unused variable 'a1' [-Wunused-variable]
57 | int a1=query(need[i]);
| ^~
minerals.cpp:63:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
63 | for (int i=rr;i<need.size();i++)
| ~^~~~~~~~~~~~
minerals.cpp:65:26: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
65 | if (aa.size()==2*rr)
| ~~~~~~~~~^~~~~~
minerals.cpp:77:21: warning: unused variable 'a2' [-Wunused-variable]
77 | int a2=query(need[i]);
| ^~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
1 ms |
344 KB |
Output is correct |
4 |
Correct |
1 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
2 ms |
344 KB |
Output is correct |
3 |
Correct |
4 ms |
600 KB |
Output is correct |
4 |
Correct |
9 ms |
764 KB |
Output is correct |
5 |
Correct |
16 ms |
1368 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
1 ms |
344 KB |
Output is correct |
4 |
Correct |
1 ms |
344 KB |
Output is correct |
5 |
Correct |
1 ms |
344 KB |
Output is correct |
6 |
Correct |
2 ms |
344 KB |
Output is correct |
7 |
Correct |
4 ms |
600 KB |
Output is correct |
8 |
Correct |
9 ms |
764 KB |
Output is correct |
9 |
Correct |
16 ms |
1368 KB |
Output is correct |
10 |
Correct |
1 ms |
344 KB |
Output is correct |
11 |
Correct |
11 ms |
1036 KB |
Output is correct |
12 |
Correct |
18 ms |
1368 KB |
Output is correct |
13 |
Correct |
17 ms |
1792 KB |
Output is correct |
14 |
Correct |
17 ms |
1368 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
1 ms |
344 KB |
Output is correct |
4 |
Correct |
1 ms |
344 KB |
Output is correct |
5 |
Correct |
1 ms |
344 KB |
Output is correct |
6 |
Correct |
2 ms |
344 KB |
Output is correct |
7 |
Correct |
4 ms |
600 KB |
Output is correct |
8 |
Correct |
9 ms |
764 KB |
Output is correct |
9 |
Correct |
16 ms |
1368 KB |
Output is correct |
10 |
Correct |
1 ms |
344 KB |
Output is correct |
11 |
Correct |
11 ms |
1036 KB |
Output is correct |
12 |
Correct |
18 ms |
1368 KB |
Output is correct |
13 |
Correct |
17 ms |
1792 KB |
Output is correct |
14 |
Correct |
17 ms |
1368 KB |
Output is correct |
15 |
Incorrect |
33 ms |
3016 KB |
Wrong Answer [2] |
16 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
1 ms |
344 KB |
Output is correct |
4 |
Correct |
1 ms |
344 KB |
Output is correct |
5 |
Correct |
1 ms |
344 KB |
Output is correct |
6 |
Correct |
2 ms |
344 KB |
Output is correct |
7 |
Correct |
4 ms |
600 KB |
Output is correct |
8 |
Correct |
9 ms |
764 KB |
Output is correct |
9 |
Correct |
16 ms |
1368 KB |
Output is correct |
10 |
Correct |
1 ms |
344 KB |
Output is correct |
11 |
Correct |
11 ms |
1036 KB |
Output is correct |
12 |
Correct |
18 ms |
1368 KB |
Output is correct |
13 |
Correct |
17 ms |
1792 KB |
Output is correct |
14 |
Correct |
17 ms |
1368 KB |
Output is correct |
15 |
Incorrect |
33 ms |
3016 KB |
Wrong Answer [2] |
16 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
1 ms |
344 KB |
Output is correct |
4 |
Correct |
1 ms |
344 KB |
Output is correct |
5 |
Correct |
1 ms |
344 KB |
Output is correct |
6 |
Correct |
2 ms |
344 KB |
Output is correct |
7 |
Correct |
4 ms |
600 KB |
Output is correct |
8 |
Correct |
9 ms |
764 KB |
Output is correct |
9 |
Correct |
16 ms |
1368 KB |
Output is correct |
10 |
Correct |
1 ms |
344 KB |
Output is correct |
11 |
Correct |
11 ms |
1036 KB |
Output is correct |
12 |
Correct |
18 ms |
1368 KB |
Output is correct |
13 |
Correct |
17 ms |
1792 KB |
Output is correct |
14 |
Correct |
17 ms |
1368 KB |
Output is correct |
15 |
Incorrect |
33 ms |
3016 KB |
Wrong Answer [2] |
16 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
1 ms |
344 KB |
Output is correct |
4 |
Correct |
1 ms |
344 KB |
Output is correct |
5 |
Correct |
1 ms |
344 KB |
Output is correct |
6 |
Correct |
2 ms |
344 KB |
Output is correct |
7 |
Correct |
4 ms |
600 KB |
Output is correct |
8 |
Correct |
9 ms |
764 KB |
Output is correct |
9 |
Correct |
16 ms |
1368 KB |
Output is correct |
10 |
Correct |
1 ms |
344 KB |
Output is correct |
11 |
Correct |
11 ms |
1036 KB |
Output is correct |
12 |
Correct |
18 ms |
1368 KB |
Output is correct |
13 |
Correct |
17 ms |
1792 KB |
Output is correct |
14 |
Correct |
17 ms |
1368 KB |
Output is correct |
15 |
Incorrect |
33 ms |
3016 KB |
Wrong Answer [2] |
16 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
1 ms |
344 KB |
Output is correct |
4 |
Correct |
1 ms |
344 KB |
Output is correct |
5 |
Correct |
1 ms |
344 KB |
Output is correct |
6 |
Correct |
2 ms |
344 KB |
Output is correct |
7 |
Correct |
4 ms |
600 KB |
Output is correct |
8 |
Correct |
9 ms |
764 KB |
Output is correct |
9 |
Correct |
16 ms |
1368 KB |
Output is correct |
10 |
Correct |
1 ms |
344 KB |
Output is correct |
11 |
Correct |
11 ms |
1036 KB |
Output is correct |
12 |
Correct |
18 ms |
1368 KB |
Output is correct |
13 |
Correct |
17 ms |
1792 KB |
Output is correct |
14 |
Correct |
17 ms |
1368 KB |
Output is correct |
15 |
Incorrect |
33 ms |
3016 KB |
Wrong Answer [2] |
16 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
1 ms |
344 KB |
Output is correct |
4 |
Correct |
1 ms |
344 KB |
Output is correct |
5 |
Correct |
1 ms |
344 KB |
Output is correct |
6 |
Correct |
2 ms |
344 KB |
Output is correct |
7 |
Correct |
4 ms |
600 KB |
Output is correct |
8 |
Correct |
9 ms |
764 KB |
Output is correct |
9 |
Correct |
16 ms |
1368 KB |
Output is correct |
10 |
Correct |
1 ms |
344 KB |
Output is correct |
11 |
Correct |
11 ms |
1036 KB |
Output is correct |
12 |
Correct |
18 ms |
1368 KB |
Output is correct |
13 |
Correct |
17 ms |
1792 KB |
Output is correct |
14 |
Correct |
17 ms |
1368 KB |
Output is correct |
15 |
Incorrect |
33 ms |
3016 KB |
Wrong Answer [2] |
16 |
Halted |
0 ms |
0 KB |
- |