#include "minerals.h"
#include <vector>
using namespace std;
int cur=0;
vector<int> v1,v2;
bool query(int x)
{
int tmp=Query(x);
if (cur==tmp)
return 1;
cur=tmp;
return 0;
}
void solve(vector<int> a,vector<int> b,bool added)
{
if (a.size()==1)
{
Answer(a[0],b[0]);
return;
}
int mid=a.size()/2;
vector<int> aa[2],bb[2];
for (int i=0;i<a.size();i++)
{
if (i<mid)
{
aa[0].push_back(a[i]);
if (!added)
query(a[i]);
}
else
{
aa[1].push_back(a[i]);
if (added)
query(a[i]);
}
}
for (int i:b)
{
if (query(i))
bb[0].push_back(i);
else
bb[1].push_back(i);
}
solve(aa[0],bb[0],1);
solve(aa[1],bb[1],0);
}
void Solve(int n)
{
for (int i=1;i<=2*n;i++)
{
if (query(i))
v2.push_back(i);
else
v1.push_back(i);
}
solve(v1,v2,1);
}
Compilation message
minerals.cpp: In function 'void solve(std::vector<int>, std::vector<int>, bool)':
minerals.cpp:23:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (int i=0;i<a.size();i++)
~^~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
248 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
504 KB |
Output is correct |
2 |
Correct |
4 ms |
376 KB |
Output is correct |
3 |
Correct |
7 ms |
504 KB |
Output is correct |
4 |
Correct |
11 ms |
760 KB |
Output is correct |
5 |
Correct |
22 ms |
1324 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
248 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
5 |
Correct |
3 ms |
504 KB |
Output is correct |
6 |
Correct |
4 ms |
376 KB |
Output is correct |
7 |
Correct |
7 ms |
504 KB |
Output is correct |
8 |
Correct |
11 ms |
760 KB |
Output is correct |
9 |
Correct |
22 ms |
1324 KB |
Output is correct |
10 |
Correct |
3 ms |
380 KB |
Output is correct |
11 |
Correct |
16 ms |
1016 KB |
Output is correct |
12 |
Correct |
23 ms |
1444 KB |
Output is correct |
13 |
Correct |
19 ms |
1328 KB |
Output is correct |
14 |
Correct |
19 ms |
1404 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
248 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
5 |
Correct |
3 ms |
504 KB |
Output is correct |
6 |
Correct |
4 ms |
376 KB |
Output is correct |
7 |
Correct |
7 ms |
504 KB |
Output is correct |
8 |
Correct |
11 ms |
760 KB |
Output is correct |
9 |
Correct |
22 ms |
1324 KB |
Output is correct |
10 |
Correct |
3 ms |
380 KB |
Output is correct |
11 |
Correct |
16 ms |
1016 KB |
Output is correct |
12 |
Correct |
23 ms |
1444 KB |
Output is correct |
13 |
Correct |
19 ms |
1328 KB |
Output is correct |
14 |
Correct |
19 ms |
1404 KB |
Output is correct |
15 |
Correct |
62 ms |
3144 KB |
Output is correct |
16 |
Correct |
61 ms |
3172 KB |
Output is correct |
17 |
Correct |
49 ms |
3096 KB |
Output is correct |
18 |
Correct |
48 ms |
2948 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
248 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
5 |
Correct |
3 ms |
504 KB |
Output is correct |
6 |
Correct |
4 ms |
376 KB |
Output is correct |
7 |
Correct |
7 ms |
504 KB |
Output is correct |
8 |
Correct |
11 ms |
760 KB |
Output is correct |
9 |
Correct |
22 ms |
1324 KB |
Output is correct |
10 |
Correct |
3 ms |
380 KB |
Output is correct |
11 |
Correct |
16 ms |
1016 KB |
Output is correct |
12 |
Correct |
23 ms |
1444 KB |
Output is correct |
13 |
Correct |
19 ms |
1328 KB |
Output is correct |
14 |
Correct |
19 ms |
1404 KB |
Output is correct |
15 |
Correct |
62 ms |
3144 KB |
Output is correct |
16 |
Correct |
61 ms |
3172 KB |
Output is correct |
17 |
Correct |
49 ms |
3096 KB |
Output is correct |
18 |
Correct |
48 ms |
2948 KB |
Output is correct |
19 |
Correct |
63 ms |
3316 KB |
Output is correct |
20 |
Correct |
64 ms |
3256 KB |
Output is correct |
21 |
Correct |
49 ms |
3144 KB |
Output is correct |
22 |
Correct |
49 ms |
2980 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
248 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
5 |
Correct |
3 ms |
504 KB |
Output is correct |
6 |
Correct |
4 ms |
376 KB |
Output is correct |
7 |
Correct |
7 ms |
504 KB |
Output is correct |
8 |
Correct |
11 ms |
760 KB |
Output is correct |
9 |
Correct |
22 ms |
1324 KB |
Output is correct |
10 |
Correct |
3 ms |
380 KB |
Output is correct |
11 |
Correct |
16 ms |
1016 KB |
Output is correct |
12 |
Correct |
23 ms |
1444 KB |
Output is correct |
13 |
Correct |
19 ms |
1328 KB |
Output is correct |
14 |
Correct |
19 ms |
1404 KB |
Output is correct |
15 |
Correct |
62 ms |
3144 KB |
Output is correct |
16 |
Correct |
61 ms |
3172 KB |
Output is correct |
17 |
Correct |
49 ms |
3096 KB |
Output is correct |
18 |
Correct |
48 ms |
2948 KB |
Output is correct |
19 |
Correct |
63 ms |
3316 KB |
Output is correct |
20 |
Correct |
64 ms |
3256 KB |
Output is correct |
21 |
Correct |
49 ms |
3144 KB |
Output is correct |
22 |
Correct |
49 ms |
2980 KB |
Output is correct |
23 |
Correct |
64 ms |
3340 KB |
Output is correct |
24 |
Correct |
68 ms |
3332 KB |
Output is correct |
25 |
Correct |
53 ms |
3324 KB |
Output is correct |
26 |
Correct |
54 ms |
3148 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
248 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
5 |
Correct |
3 ms |
504 KB |
Output is correct |
6 |
Correct |
4 ms |
376 KB |
Output is correct |
7 |
Correct |
7 ms |
504 KB |
Output is correct |
8 |
Correct |
11 ms |
760 KB |
Output is correct |
9 |
Correct |
22 ms |
1324 KB |
Output is correct |
10 |
Correct |
3 ms |
380 KB |
Output is correct |
11 |
Correct |
16 ms |
1016 KB |
Output is correct |
12 |
Correct |
23 ms |
1444 KB |
Output is correct |
13 |
Correct |
19 ms |
1328 KB |
Output is correct |
14 |
Correct |
19 ms |
1404 KB |
Output is correct |
15 |
Correct |
62 ms |
3144 KB |
Output is correct |
16 |
Correct |
61 ms |
3172 KB |
Output is correct |
17 |
Correct |
49 ms |
3096 KB |
Output is correct |
18 |
Correct |
48 ms |
2948 KB |
Output is correct |
19 |
Correct |
63 ms |
3316 KB |
Output is correct |
20 |
Correct |
64 ms |
3256 KB |
Output is correct |
21 |
Correct |
49 ms |
3144 KB |
Output is correct |
22 |
Correct |
49 ms |
2980 KB |
Output is correct |
23 |
Correct |
64 ms |
3340 KB |
Output is correct |
24 |
Correct |
68 ms |
3332 KB |
Output is correct |
25 |
Correct |
53 ms |
3324 KB |
Output is correct |
26 |
Correct |
54 ms |
3148 KB |
Output is correct |
27 |
Incorrect |
73 ms |
3512 KB |
Wrong Answer [2] |
28 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
248 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
5 |
Correct |
3 ms |
504 KB |
Output is correct |
6 |
Correct |
4 ms |
376 KB |
Output is correct |
7 |
Correct |
7 ms |
504 KB |
Output is correct |
8 |
Correct |
11 ms |
760 KB |
Output is correct |
9 |
Correct |
22 ms |
1324 KB |
Output is correct |
10 |
Correct |
3 ms |
380 KB |
Output is correct |
11 |
Correct |
16 ms |
1016 KB |
Output is correct |
12 |
Correct |
23 ms |
1444 KB |
Output is correct |
13 |
Correct |
19 ms |
1328 KB |
Output is correct |
14 |
Correct |
19 ms |
1404 KB |
Output is correct |
15 |
Correct |
62 ms |
3144 KB |
Output is correct |
16 |
Correct |
61 ms |
3172 KB |
Output is correct |
17 |
Correct |
49 ms |
3096 KB |
Output is correct |
18 |
Correct |
48 ms |
2948 KB |
Output is correct |
19 |
Correct |
63 ms |
3316 KB |
Output is correct |
20 |
Correct |
64 ms |
3256 KB |
Output is correct |
21 |
Correct |
49 ms |
3144 KB |
Output is correct |
22 |
Correct |
49 ms |
2980 KB |
Output is correct |
23 |
Correct |
64 ms |
3340 KB |
Output is correct |
24 |
Correct |
68 ms |
3332 KB |
Output is correct |
25 |
Correct |
53 ms |
3324 KB |
Output is correct |
26 |
Correct |
54 ms |
3148 KB |
Output is correct |
27 |
Incorrect |
73 ms |
3512 KB |
Wrong Answer [2] |
28 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
248 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
5 |
Correct |
3 ms |
504 KB |
Output is correct |
6 |
Correct |
4 ms |
376 KB |
Output is correct |
7 |
Correct |
7 ms |
504 KB |
Output is correct |
8 |
Correct |
11 ms |
760 KB |
Output is correct |
9 |
Correct |
22 ms |
1324 KB |
Output is correct |
10 |
Correct |
3 ms |
380 KB |
Output is correct |
11 |
Correct |
16 ms |
1016 KB |
Output is correct |
12 |
Correct |
23 ms |
1444 KB |
Output is correct |
13 |
Correct |
19 ms |
1328 KB |
Output is correct |
14 |
Correct |
19 ms |
1404 KB |
Output is correct |
15 |
Correct |
62 ms |
3144 KB |
Output is correct |
16 |
Correct |
61 ms |
3172 KB |
Output is correct |
17 |
Correct |
49 ms |
3096 KB |
Output is correct |
18 |
Correct |
48 ms |
2948 KB |
Output is correct |
19 |
Correct |
63 ms |
3316 KB |
Output is correct |
20 |
Correct |
64 ms |
3256 KB |
Output is correct |
21 |
Correct |
49 ms |
3144 KB |
Output is correct |
22 |
Correct |
49 ms |
2980 KB |
Output is correct |
23 |
Correct |
64 ms |
3340 KB |
Output is correct |
24 |
Correct |
68 ms |
3332 KB |
Output is correct |
25 |
Correct |
53 ms |
3324 KB |
Output is correct |
26 |
Correct |
54 ms |
3148 KB |
Output is correct |
27 |
Incorrect |
73 ms |
3512 KB |
Wrong Answer [2] |
28 |
Halted |
0 ms |
0 KB |
- |