#include "minerals.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
void dfs(int n, const vector<int> &a, const vector<int> &b, bool empty = true) {
if (n == 1) {
Answer(a.front(), b.front());
if (not empty) Query(a.front());
return;
}
int m = (n + 1) >> 1;
vector<int> al, ar, bl, br;
for (int i = 0; i < m; ++i) {
al.emplace_back(a[i]);
if (empty) Query(a[i]);
}
for (int i = m; i < n; ++i) {
ar.emplace_back(a[i]);
if (not empty) Query(a[i]);
}
for (int i = 0; i < n; ++i) {
if (Query(b[i]) == m) {
bl.emplace_back(b[i]);
} else {
br.emplace_back(b[i]);
}
Query(b[i]);
}
dfs(m, al, bl, false);
dfs(n - m, ar, br, true);
}
void Solve(int N) {
vector<int> a, b;
for (int i = 1; i <= N * 2; ++i) {
if (Query(i) == a.size()) {
Query(i);
b.emplace_back(i);
} else {
a.emplace_back(i);
}
}
dfs(N, a, b, false);
}
Compilation message
minerals.cpp: In function 'void Solve(int)':
minerals.cpp:38:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
38 | if (Query(i) == a.size()) {
| ~~~~~~~~~^~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
344 KB |
Output is correct |
3 |
Correct |
0 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 |
1 ms |
344 KB |
Output is correct |
3 |
Correct |
2 ms |
600 KB |
Output is correct |
4 |
Correct |
5 ms |
828 KB |
Output is correct |
5 |
Correct |
12 ms |
1212 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 |
0 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 |
1 ms |
344 KB |
Output is correct |
7 |
Correct |
2 ms |
600 KB |
Output is correct |
8 |
Correct |
5 ms |
828 KB |
Output is correct |
9 |
Correct |
12 ms |
1212 KB |
Output is correct |
10 |
Correct |
1 ms |
344 KB |
Output is correct |
11 |
Correct |
7 ms |
984 KB |
Output is correct |
12 |
Correct |
8 ms |
1112 KB |
Output is correct |
13 |
Correct |
8 ms |
1296 KB |
Output is correct |
14 |
Correct |
7 ms |
1112 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 |
0 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 |
1 ms |
344 KB |
Output is correct |
7 |
Correct |
2 ms |
600 KB |
Output is correct |
8 |
Correct |
5 ms |
828 KB |
Output is correct |
9 |
Correct |
12 ms |
1212 KB |
Output is correct |
10 |
Correct |
1 ms |
344 KB |
Output is correct |
11 |
Correct |
7 ms |
984 KB |
Output is correct |
12 |
Correct |
8 ms |
1112 KB |
Output is correct |
13 |
Correct |
8 ms |
1296 KB |
Output is correct |
14 |
Correct |
7 ms |
1112 KB |
Output is correct |
15 |
Incorrect |
16 ms |
2648 KB |
Wrong Answer [2] |
16 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
344 KB |
Output is correct |
3 |
Correct |
0 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 |
1 ms |
344 KB |
Output is correct |
7 |
Correct |
2 ms |
600 KB |
Output is correct |
8 |
Correct |
5 ms |
828 KB |
Output is correct |
9 |
Correct |
12 ms |
1212 KB |
Output is correct |
10 |
Correct |
1 ms |
344 KB |
Output is correct |
11 |
Correct |
7 ms |
984 KB |
Output is correct |
12 |
Correct |
8 ms |
1112 KB |
Output is correct |
13 |
Correct |
8 ms |
1296 KB |
Output is correct |
14 |
Correct |
7 ms |
1112 KB |
Output is correct |
15 |
Incorrect |
16 ms |
2648 KB |
Wrong Answer [2] |
16 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
344 KB |
Output is correct |
3 |
Correct |
0 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 |
1 ms |
344 KB |
Output is correct |
7 |
Correct |
2 ms |
600 KB |
Output is correct |
8 |
Correct |
5 ms |
828 KB |
Output is correct |
9 |
Correct |
12 ms |
1212 KB |
Output is correct |
10 |
Correct |
1 ms |
344 KB |
Output is correct |
11 |
Correct |
7 ms |
984 KB |
Output is correct |
12 |
Correct |
8 ms |
1112 KB |
Output is correct |
13 |
Correct |
8 ms |
1296 KB |
Output is correct |
14 |
Correct |
7 ms |
1112 KB |
Output is correct |
15 |
Incorrect |
16 ms |
2648 KB |
Wrong Answer [2] |
16 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
344 KB |
Output is correct |
3 |
Correct |
0 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 |
1 ms |
344 KB |
Output is correct |
7 |
Correct |
2 ms |
600 KB |
Output is correct |
8 |
Correct |
5 ms |
828 KB |
Output is correct |
9 |
Correct |
12 ms |
1212 KB |
Output is correct |
10 |
Correct |
1 ms |
344 KB |
Output is correct |
11 |
Correct |
7 ms |
984 KB |
Output is correct |
12 |
Correct |
8 ms |
1112 KB |
Output is correct |
13 |
Correct |
8 ms |
1296 KB |
Output is correct |
14 |
Correct |
7 ms |
1112 KB |
Output is correct |
15 |
Incorrect |
16 ms |
2648 KB |
Wrong Answer [2] |
16 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
344 KB |
Output is correct |
3 |
Correct |
0 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 |
1 ms |
344 KB |
Output is correct |
7 |
Correct |
2 ms |
600 KB |
Output is correct |
8 |
Correct |
5 ms |
828 KB |
Output is correct |
9 |
Correct |
12 ms |
1212 KB |
Output is correct |
10 |
Correct |
1 ms |
344 KB |
Output is correct |
11 |
Correct |
7 ms |
984 KB |
Output is correct |
12 |
Correct |
8 ms |
1112 KB |
Output is correct |
13 |
Correct |
8 ms |
1296 KB |
Output is correct |
14 |
Correct |
7 ms |
1112 KB |
Output is correct |
15 |
Incorrect |
16 ms |
2648 KB |
Wrong Answer [2] |
16 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
344 KB |
Output is correct |
3 |
Correct |
0 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 |
1 ms |
344 KB |
Output is correct |
7 |
Correct |
2 ms |
600 KB |
Output is correct |
8 |
Correct |
5 ms |
828 KB |
Output is correct |
9 |
Correct |
12 ms |
1212 KB |
Output is correct |
10 |
Correct |
1 ms |
344 KB |
Output is correct |
11 |
Correct |
7 ms |
984 KB |
Output is correct |
12 |
Correct |
8 ms |
1112 KB |
Output is correct |
13 |
Correct |
8 ms |
1296 KB |
Output is correct |
14 |
Correct |
7 ms |
1112 KB |
Output is correct |
15 |
Incorrect |
16 ms |
2648 KB |
Wrong Answer [2] |
16 |
Halted |
0 ms |
0 KB |
- |