#include "chameleon.h"
#include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for (int i = a; i < (b); ++i)
#define per(i, a, b) for (int i = b - 1; i >= (a); --i)
#define trav(a, x) for (auto &a : x)
#define all(x) x.begin(), x.end()
#define sz(x) x.size()
#define pb push_back
#define umap unordered_map
#define uset unordered_set
typedef pair<int, int> ii;
typedef pair<int, ii> iii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<vi> vvi;
typedef long long ll;
const int INF = 1'000'000'007;
namespace {
int variable_example = 1;
} // namespace
bitset<1001> taken;
void bsearch(vi chams, int cham) {
if (sz(chams) == 1) {
taken[chams[0]-1] = 1;
Answer(cham, chams[0]);
return;
}
int si = sz(chams);
vi next(si >> 1);
rep(i, 0, si >> 1) next[i] = chams[i];
int c1 = Query(next);
next.pb(cham);
int c2 = Query(next);
if (c1 == c2)
next.pop_back();
else {
next.clear();
rep(i, si >> 1, si)next.pb(chams[i]);
}
bsearch(next,cham);
}
void Solve(int n) {
rep(i, 0, n*2) {
if (taken[i]) continue;
taken[i] = 1;
vi vec;
rep(j, 0, n*2) if (!taken[j]) vec.pb(j + 1);
bsearch(vec,i+1);
}
}
Compilation message
chameleon.cpp:29:5: warning: '{anonymous}::variable_example' defined but not used [-Wunused-variable]
29 | int variable_example = 1;
| ^~~~~~~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
268 KB |
Output is correct |
2 |
Correct |
1 ms |
200 KB |
Output is correct |
3 |
Correct |
18 ms |
356 KB |
Output is correct |
4 |
Correct |
18 ms |
380 KB |
Output is correct |
5 |
Correct |
19 ms |
364 KB |
Output is correct |
6 |
Correct |
26 ms |
348 KB |
Output is correct |
7 |
Correct |
22 ms |
412 KB |
Output is correct |
8 |
Correct |
18 ms |
364 KB |
Output is correct |
9 |
Correct |
18 ms |
372 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 |
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 |
268 KB |
Output is correct |
2 |
Correct |
1 ms |
200 KB |
Output is correct |
3 |
Correct |
18 ms |
356 KB |
Output is correct |
4 |
Correct |
18 ms |
380 KB |
Output is correct |
5 |
Correct |
19 ms |
364 KB |
Output is correct |
6 |
Correct |
26 ms |
348 KB |
Output is correct |
7 |
Correct |
22 ms |
412 KB |
Output is correct |
8 |
Correct |
18 ms |
364 KB |
Output is correct |
9 |
Correct |
18 ms |
372 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 |
- |