#include "chameleon.h"
#include<bits/stdc++.h>
using namespace std;
#define fast ios::sync_with_stdio(false); cin.tie(0);
#define fi first
#define se second
#define all(v) (v).begin(), (v).end()
#define em emplace
#define eb emplace_back
#define mp make_pair
bool chk[555];
int f(int l, int r, int k) {
if(l == r) return l;
int m = l + r >> 1;
vector<int> x = {k}, y;
for(int i=l; i<=m; i++) {
if(!chk[i]) x.eb(i), y.eb(i);
}
if(Query(x) == Query(y)) {
return f(l, m, k);
}
else return f(m+1, r, k);
}
void Solve(int N) {
int n = N;
for(int i=1; i <= 2 * n; i++) {
if(chk[i]) continue;
chk[i] = true;
int j = f(1, 2*n, i);
if(!chk[j]) Answer(i, j);
chk[j] = true;
}
}
Compilation message
chameleon.cpp: In function 'int f(int, int, int)':
chameleon.cpp:18:13: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
18 | int m = l + r >> 1;
| ~~^~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
384 KB |
Output is correct |
2 |
Correct |
1 ms |
384 KB |
Output is correct |
3 |
Incorrect |
2 ms |
384 KB |
Wrong Answer [5] |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
384 KB |
Output is correct |
2 |
Incorrect |
1 ms |
384 KB |
Wrong Answer [6] |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
384 KB |
Output is correct |
2 |
Incorrect |
1 ms |
384 KB |
Wrong Answer [6] |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
384 KB |
Output is correct |
2 |
Incorrect |
0 ms |
384 KB |
Wrong Answer [6] |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
384 KB |
Output is correct |
2 |
Correct |
1 ms |
384 KB |
Output is correct |
3 |
Incorrect |
2 ms |
384 KB |
Wrong Answer [5] |
4 |
Halted |
0 ms |
0 KB |
- |