#ifndef EVAL
#include "grader.cpp"
#endif
#include "chameleon.h"
#include <bits/stdc++.h>
#define fr first
#define sc second
#define pii pair<int, int>
#define pb push_back
#define szof(s) (int)s.size()
#define all(s) s.begin(), s.end()
#define ll long long
using namespace std;
const int MAXN = 505;
// Query(p) | p is vector<int>
// Answer(a, b)
int n;
bool found[MAXN * 2];
int cc = 0;
int find_pos(vector <int> vec, int my_pos) {
if (szof(vec) == 1) {
return vec[0];
}
int mid = szof(vec) / 2 - 1;
vector <int> left, right;
for (int i = 0; i < szof(vec); i++) {
if (i <= mid) {
left.pb(vec[i]);
}
else {
right.pb(vec[i]);
}
}
int before = Query(left);
left.pb(my_pos);
int after = Query(left);
left.pop_back();
if (before == after) {
return find_pos(left, my_pos);
} else {
return find_pos(right, my_pos);
}
}
void Solve(int N) {
n = N;
for (int i = 1; i <= n * 2; i++) {
if (found[i]) {
continue;
}
vector <int> vec;
for (int j = 1; j <= n * 2; j++) {
if (!found[j] && j != i) {
vec.pb(j);
}
}
int other = find_pos(vec, i);
found[i] = found[other] = 1;
Answer(i, other);
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
200 KB |
Output is correct |
2 |
Correct |
0 ms |
200 KB |
Output is correct |
3 |
Correct |
21 ms |
328 KB |
Output is correct |
4 |
Correct |
21 ms |
352 KB |
Output is correct |
5 |
Correct |
22 ms |
476 KB |
Output is correct |
6 |
Correct |
22 ms |
328 KB |
Output is correct |
7 |
Correct |
21 ms |
328 KB |
Output is correct |
8 |
Correct |
22 ms |
328 KB |
Output is correct |
9 |
Correct |
24 ms |
344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
200 KB |
Output is correct |
2 |
Incorrect |
1 ms |
200 KB |
Wrong Answer [6] |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
200 KB |
Output is correct |
2 |
Incorrect |
1 ms |
200 KB |
Wrong Answer [6] |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
200 KB |
Output is correct |
2 |
Incorrect |
0 ms |
200 KB |
Wrong Answer [6] |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
200 KB |
Output is correct |
2 |
Correct |
0 ms |
200 KB |
Output is correct |
3 |
Correct |
21 ms |
328 KB |
Output is correct |
4 |
Correct |
21 ms |
352 KB |
Output is correct |
5 |
Correct |
22 ms |
476 KB |
Output is correct |
6 |
Correct |
22 ms |
328 KB |
Output is correct |
7 |
Correct |
21 ms |
328 KB |
Output is correct |
8 |
Correct |
22 ms |
328 KB |
Output is correct |
9 |
Correct |
24 ms |
344 KB |
Output is correct |
10 |
Correct |
1 ms |
200 KB |
Output is correct |
11 |
Incorrect |
1 ms |
200 KB |
Wrong Answer [6] |
12 |
Halted |
0 ms |
0 KB |
- |