#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)
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
int get_rand() {
ll x = rnd();
x %= (ll)1e9;
if (x < 0) {
x = -x;
}
return x;
}
int gen(int l, int r) {
return l + (get_rand() % (r - l + 1));
}
int n;
bool found[MAXN * 2];
void Solve(int N) {
n = N;
for (int i = 1; i <= n * 2; i++) {
if (found[i]) {
continue;
}
set <int> st;
while (1) {
int pos = gen(1, n * 2);
if (!found[pos] && pos != i && st.find(pos) == st.end()) {
vector <int> ask = {i, pos};
st.insert(pos);
int res = Query(ask);
if (res == 1) {
found[i] = found[pos] = 1;
Answer(i, pos);
break;
}
}
}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
200 KB |
Output is correct |
2 |
Correct |
1 ms |
200 KB |
Output is correct |
3 |
Incorrect |
30 ms |
328 KB |
Wrong Answer [3] |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
200 KB |
Output is correct |
2 |
Correct |
1 ms |
200 KB |
Output is correct |
3 |
Incorrect |
0 ms |
200 KB |
Wrong Answer [6] |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
200 KB |
Output is correct |
2 |
Correct |
1 ms |
200 KB |
Output is correct |
3 |
Incorrect |
0 ms |
200 KB |
Wrong Answer [6] |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
200 KB |
Output is correct |
2 |
Incorrect |
1 ms |
200 KB |
Wrong Answer [6] |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
200 KB |
Output is correct |
2 |
Correct |
1 ms |
200 KB |
Output is correct |
3 |
Incorrect |
30 ms |
328 KB |
Wrong Answer [3] |
4 |
Halted |
0 ms |
0 KB |
- |