#include "minerals.h"
#include <iostream>
#include <vector>
#include <algorithm>
#include <cassert>
using namespace std;
void Solve(int N) {
vector<int> l, r;
int kek = 0;
for (int i = 1; i <= 2 * N; ++i) {
int cur = Query(i);
if (kek != cur) {
l.push_back(i);
kek = cur;
} else {
Query(i);
r.push_back(i);
}
}
for (int i : l) {
Query(i);
}
vector<int> sum(N);
for (int bit = 0; (1 << bit) < N; ++bit) {
for (int i = 0; i < N; ++i) {
if ((i >> bit) & 1) {
Query(l[i]);
}
}
for (int i = 0; i < N; ++i) {
kek = Query(r[i]);
if (kek == Query(r[i])) {
sum[i] += (1 << bit);
}
}
for (int i = 0; i < N; ++i) {
if ((i >> bit) & 1) {
Query(l[i]);
}
}
}
// for (int i = 0; i < N; ++i) {
// cout << l[sum[i]] << " " << r[i] << endl;
// }
for (int i = 0; i < N; ++i) {
Answer(l[sum[i]], r[i]);
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
200 KB |
Output is correct |
2 |
Correct |
1 ms |
200 KB |
Output is correct |
3 |
Correct |
1 ms |
200 KB |
Output is correct |
4 |
Correct |
1 ms |
200 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
328 KB |
Output is correct |
2 |
Correct |
1 ms |
328 KB |
Output is correct |
3 |
Correct |
4 ms |
428 KB |
Output is correct |
4 |
Correct |
6 ms |
612 KB |
Output is correct |
5 |
Correct |
13 ms |
768 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
200 KB |
Output is correct |
2 |
Correct |
1 ms |
200 KB |
Output is correct |
3 |
Correct |
1 ms |
200 KB |
Output is correct |
4 |
Correct |
1 ms |
200 KB |
Output is correct |
5 |
Correct |
2 ms |
328 KB |
Output is correct |
6 |
Correct |
1 ms |
328 KB |
Output is correct |
7 |
Correct |
4 ms |
428 KB |
Output is correct |
8 |
Correct |
6 ms |
612 KB |
Output is correct |
9 |
Correct |
13 ms |
768 KB |
Output is correct |
10 |
Correct |
1 ms |
328 KB |
Output is correct |
11 |
Correct |
9 ms |
756 KB |
Output is correct |
12 |
Correct |
11 ms |
920 KB |
Output is correct |
13 |
Correct |
10 ms |
864 KB |
Output is correct |
14 |
Correct |
9 ms |
788 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
200 KB |
Output is correct |
2 |
Correct |
1 ms |
200 KB |
Output is correct |
3 |
Correct |
1 ms |
200 KB |
Output is correct |
4 |
Correct |
1 ms |
200 KB |
Output is correct |
5 |
Correct |
2 ms |
328 KB |
Output is correct |
6 |
Correct |
1 ms |
328 KB |
Output is correct |
7 |
Correct |
4 ms |
428 KB |
Output is correct |
8 |
Correct |
6 ms |
612 KB |
Output is correct |
9 |
Correct |
13 ms |
768 KB |
Output is correct |
10 |
Correct |
1 ms |
328 KB |
Output is correct |
11 |
Correct |
9 ms |
756 KB |
Output is correct |
12 |
Correct |
11 ms |
920 KB |
Output is correct |
13 |
Correct |
10 ms |
864 KB |
Output is correct |
14 |
Correct |
9 ms |
788 KB |
Output is correct |
15 |
Incorrect |
21 ms |
1724 KB |
Wrong Answer [2] |
16 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
200 KB |
Output is correct |
2 |
Correct |
1 ms |
200 KB |
Output is correct |
3 |
Correct |
1 ms |
200 KB |
Output is correct |
4 |
Correct |
1 ms |
200 KB |
Output is correct |
5 |
Correct |
2 ms |
328 KB |
Output is correct |
6 |
Correct |
1 ms |
328 KB |
Output is correct |
7 |
Correct |
4 ms |
428 KB |
Output is correct |
8 |
Correct |
6 ms |
612 KB |
Output is correct |
9 |
Correct |
13 ms |
768 KB |
Output is correct |
10 |
Correct |
1 ms |
328 KB |
Output is correct |
11 |
Correct |
9 ms |
756 KB |
Output is correct |
12 |
Correct |
11 ms |
920 KB |
Output is correct |
13 |
Correct |
10 ms |
864 KB |
Output is correct |
14 |
Correct |
9 ms |
788 KB |
Output is correct |
15 |
Incorrect |
21 ms |
1724 KB |
Wrong Answer [2] |
16 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
200 KB |
Output is correct |
2 |
Correct |
1 ms |
200 KB |
Output is correct |
3 |
Correct |
1 ms |
200 KB |
Output is correct |
4 |
Correct |
1 ms |
200 KB |
Output is correct |
5 |
Correct |
2 ms |
328 KB |
Output is correct |
6 |
Correct |
1 ms |
328 KB |
Output is correct |
7 |
Correct |
4 ms |
428 KB |
Output is correct |
8 |
Correct |
6 ms |
612 KB |
Output is correct |
9 |
Correct |
13 ms |
768 KB |
Output is correct |
10 |
Correct |
1 ms |
328 KB |
Output is correct |
11 |
Correct |
9 ms |
756 KB |
Output is correct |
12 |
Correct |
11 ms |
920 KB |
Output is correct |
13 |
Correct |
10 ms |
864 KB |
Output is correct |
14 |
Correct |
9 ms |
788 KB |
Output is correct |
15 |
Incorrect |
21 ms |
1724 KB |
Wrong Answer [2] |
16 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
200 KB |
Output is correct |
2 |
Correct |
1 ms |
200 KB |
Output is correct |
3 |
Correct |
1 ms |
200 KB |
Output is correct |
4 |
Correct |
1 ms |
200 KB |
Output is correct |
5 |
Correct |
2 ms |
328 KB |
Output is correct |
6 |
Correct |
1 ms |
328 KB |
Output is correct |
7 |
Correct |
4 ms |
428 KB |
Output is correct |
8 |
Correct |
6 ms |
612 KB |
Output is correct |
9 |
Correct |
13 ms |
768 KB |
Output is correct |
10 |
Correct |
1 ms |
328 KB |
Output is correct |
11 |
Correct |
9 ms |
756 KB |
Output is correct |
12 |
Correct |
11 ms |
920 KB |
Output is correct |
13 |
Correct |
10 ms |
864 KB |
Output is correct |
14 |
Correct |
9 ms |
788 KB |
Output is correct |
15 |
Incorrect |
21 ms |
1724 KB |
Wrong Answer [2] |
16 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
200 KB |
Output is correct |
2 |
Correct |
1 ms |
200 KB |
Output is correct |
3 |
Correct |
1 ms |
200 KB |
Output is correct |
4 |
Correct |
1 ms |
200 KB |
Output is correct |
5 |
Correct |
2 ms |
328 KB |
Output is correct |
6 |
Correct |
1 ms |
328 KB |
Output is correct |
7 |
Correct |
4 ms |
428 KB |
Output is correct |
8 |
Correct |
6 ms |
612 KB |
Output is correct |
9 |
Correct |
13 ms |
768 KB |
Output is correct |
10 |
Correct |
1 ms |
328 KB |
Output is correct |
11 |
Correct |
9 ms |
756 KB |
Output is correct |
12 |
Correct |
11 ms |
920 KB |
Output is correct |
13 |
Correct |
10 ms |
864 KB |
Output is correct |
14 |
Correct |
9 ms |
788 KB |
Output is correct |
15 |
Incorrect |
21 ms |
1724 KB |
Wrong Answer [2] |
16 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
200 KB |
Output is correct |
2 |
Correct |
1 ms |
200 KB |
Output is correct |
3 |
Correct |
1 ms |
200 KB |
Output is correct |
4 |
Correct |
1 ms |
200 KB |
Output is correct |
5 |
Correct |
2 ms |
328 KB |
Output is correct |
6 |
Correct |
1 ms |
328 KB |
Output is correct |
7 |
Correct |
4 ms |
428 KB |
Output is correct |
8 |
Correct |
6 ms |
612 KB |
Output is correct |
9 |
Correct |
13 ms |
768 KB |
Output is correct |
10 |
Correct |
1 ms |
328 KB |
Output is correct |
11 |
Correct |
9 ms |
756 KB |
Output is correct |
12 |
Correct |
11 ms |
920 KB |
Output is correct |
13 |
Correct |
10 ms |
864 KB |
Output is correct |
14 |
Correct |
9 ms |
788 KB |
Output is correct |
15 |
Incorrect |
21 ms |
1724 KB |
Wrong Answer [2] |
16 |
Halted |
0 ms |
0 KB |
- |