#include "bits/stdc++.h"
#include "minerals.h"
using namespace std;
void go(vector<int> h1 ,vector<int> h2){
if(h1.size() == 1 && h2.size() == 1){
Answer(h1.front() ,h2.front());
return;
}
vector <int> nh1 = vector<int>{h1.begin() ,h1.begin()+h1.size()/2};
vector <int> nh2 = vector<int>{h1.begin()+h1.size()/2 ,h1.end()};
for(int i=0; i<nh1.size(); i++)
Query(nh1[i]);
vector <int> mh1 ,mh2;
for(int i=0; i<h2.size(); i++){
if(Query(h2[i]) == nh1.size())
mh1.push_back(h2[i]);
else
mh2.push_back(h2[i]);
Query(h2[i]);
}
for(int i=0; i<nh1.size(); i++)
Query(nh1[i]);
if(nh1.size()) go(nh1 ,mh1);
if(nh2.size()) go(nh2 ,mh2);
}
void Solve(int N) {
vector <int> h1 ,h2;
for(int lst=0,i=1; i<=2*N; i++){
if(Query(i) == lst)
h2.push_back(i);
else
h1.push_back(i) ,lst++;
}
for(int i=1; i<=2*N; i++)
Query(i);
go(h1 ,h2);
}
Compilation message
minerals.cpp: In function 'void go(std::vector<int>, std::vector<int>)':
minerals.cpp:13:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i=0; i<nh1.size(); i++)
~^~~~~~~~~~~
minerals.cpp:17:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i=0; i<h2.size(); i++){
~^~~~~~~~~~
minerals.cpp:18:25: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if(Query(h2[i]) == nh1.size())
~~~~~~~~~~~~~^~~~~~~~~~~~~
minerals.cpp:25:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i=0; i<nh1.size(); i++)
~^~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
248 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
252 KB |
Output is correct |
4 |
Correct |
2 ms |
248 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
376 KB |
Output is correct |
2 |
Correct |
4 ms |
376 KB |
Output is correct |
3 |
Correct |
7 ms |
504 KB |
Output is correct |
4 |
Correct |
12 ms |
764 KB |
Output is correct |
5 |
Correct |
22 ms |
1276 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
248 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
252 KB |
Output is correct |
4 |
Correct |
2 ms |
248 KB |
Output is correct |
5 |
Correct |
3 ms |
376 KB |
Output is correct |
6 |
Correct |
4 ms |
376 KB |
Output is correct |
7 |
Correct |
7 ms |
504 KB |
Output is correct |
8 |
Correct |
12 ms |
764 KB |
Output is correct |
9 |
Correct |
22 ms |
1276 KB |
Output is correct |
10 |
Correct |
3 ms |
376 KB |
Output is correct |
11 |
Correct |
16 ms |
1144 KB |
Output is correct |
12 |
Correct |
22 ms |
1444 KB |
Output is correct |
13 |
Correct |
20 ms |
1460 KB |
Output is correct |
14 |
Correct |
20 ms |
1320 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
248 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
252 KB |
Output is correct |
4 |
Correct |
2 ms |
248 KB |
Output is correct |
5 |
Correct |
3 ms |
376 KB |
Output is correct |
6 |
Correct |
4 ms |
376 KB |
Output is correct |
7 |
Correct |
7 ms |
504 KB |
Output is correct |
8 |
Correct |
12 ms |
764 KB |
Output is correct |
9 |
Correct |
22 ms |
1276 KB |
Output is correct |
10 |
Correct |
3 ms |
376 KB |
Output is correct |
11 |
Correct |
16 ms |
1144 KB |
Output is correct |
12 |
Correct |
22 ms |
1444 KB |
Output is correct |
13 |
Correct |
20 ms |
1460 KB |
Output is correct |
14 |
Correct |
20 ms |
1320 KB |
Output is correct |
15 |
Incorrect |
39 ms |
3156 KB |
Wrong Answer [2] |
16 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
248 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
252 KB |
Output is correct |
4 |
Correct |
2 ms |
248 KB |
Output is correct |
5 |
Correct |
3 ms |
376 KB |
Output is correct |
6 |
Correct |
4 ms |
376 KB |
Output is correct |
7 |
Correct |
7 ms |
504 KB |
Output is correct |
8 |
Correct |
12 ms |
764 KB |
Output is correct |
9 |
Correct |
22 ms |
1276 KB |
Output is correct |
10 |
Correct |
3 ms |
376 KB |
Output is correct |
11 |
Correct |
16 ms |
1144 KB |
Output is correct |
12 |
Correct |
22 ms |
1444 KB |
Output is correct |
13 |
Correct |
20 ms |
1460 KB |
Output is correct |
14 |
Correct |
20 ms |
1320 KB |
Output is correct |
15 |
Incorrect |
39 ms |
3156 KB |
Wrong Answer [2] |
16 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
248 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
252 KB |
Output is correct |
4 |
Correct |
2 ms |
248 KB |
Output is correct |
5 |
Correct |
3 ms |
376 KB |
Output is correct |
6 |
Correct |
4 ms |
376 KB |
Output is correct |
7 |
Correct |
7 ms |
504 KB |
Output is correct |
8 |
Correct |
12 ms |
764 KB |
Output is correct |
9 |
Correct |
22 ms |
1276 KB |
Output is correct |
10 |
Correct |
3 ms |
376 KB |
Output is correct |
11 |
Correct |
16 ms |
1144 KB |
Output is correct |
12 |
Correct |
22 ms |
1444 KB |
Output is correct |
13 |
Correct |
20 ms |
1460 KB |
Output is correct |
14 |
Correct |
20 ms |
1320 KB |
Output is correct |
15 |
Incorrect |
39 ms |
3156 KB |
Wrong Answer [2] |
16 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
248 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
252 KB |
Output is correct |
4 |
Correct |
2 ms |
248 KB |
Output is correct |
5 |
Correct |
3 ms |
376 KB |
Output is correct |
6 |
Correct |
4 ms |
376 KB |
Output is correct |
7 |
Correct |
7 ms |
504 KB |
Output is correct |
8 |
Correct |
12 ms |
764 KB |
Output is correct |
9 |
Correct |
22 ms |
1276 KB |
Output is correct |
10 |
Correct |
3 ms |
376 KB |
Output is correct |
11 |
Correct |
16 ms |
1144 KB |
Output is correct |
12 |
Correct |
22 ms |
1444 KB |
Output is correct |
13 |
Correct |
20 ms |
1460 KB |
Output is correct |
14 |
Correct |
20 ms |
1320 KB |
Output is correct |
15 |
Incorrect |
39 ms |
3156 KB |
Wrong Answer [2] |
16 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
248 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
252 KB |
Output is correct |
4 |
Correct |
2 ms |
248 KB |
Output is correct |
5 |
Correct |
3 ms |
376 KB |
Output is correct |
6 |
Correct |
4 ms |
376 KB |
Output is correct |
7 |
Correct |
7 ms |
504 KB |
Output is correct |
8 |
Correct |
12 ms |
764 KB |
Output is correct |
9 |
Correct |
22 ms |
1276 KB |
Output is correct |
10 |
Correct |
3 ms |
376 KB |
Output is correct |
11 |
Correct |
16 ms |
1144 KB |
Output is correct |
12 |
Correct |
22 ms |
1444 KB |
Output is correct |
13 |
Correct |
20 ms |
1460 KB |
Output is correct |
14 |
Correct |
20 ms |
1320 KB |
Output is correct |
15 |
Incorrect |
39 ms |
3156 KB |
Wrong Answer [2] |
16 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
248 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
252 KB |
Output is correct |
4 |
Correct |
2 ms |
248 KB |
Output is correct |
5 |
Correct |
3 ms |
376 KB |
Output is correct |
6 |
Correct |
4 ms |
376 KB |
Output is correct |
7 |
Correct |
7 ms |
504 KB |
Output is correct |
8 |
Correct |
12 ms |
764 KB |
Output is correct |
9 |
Correct |
22 ms |
1276 KB |
Output is correct |
10 |
Correct |
3 ms |
376 KB |
Output is correct |
11 |
Correct |
16 ms |
1144 KB |
Output is correct |
12 |
Correct |
22 ms |
1444 KB |
Output is correct |
13 |
Correct |
20 ms |
1460 KB |
Output is correct |
14 |
Correct |
20 ms |
1320 KB |
Output is correct |
15 |
Incorrect |
39 ms |
3156 KB |
Wrong Answer [2] |
16 |
Halted |
0 ms |
0 KB |
- |