#include "chameleon.h"
#include <vector>
#include<bits/stdc++.h>
using namespace std;
namespace {
const int NN = 1e3 + 10;
vector<int> adj[NN];
bool g[NN][NN];
int love[NN][NN];
void solve(int n) {
for(int i = 1; i <= 2 * n; i++) for(int j = i + 1; j <= 2 * n; j++) {
if (Query({i, j}) == 1) {
adj[i].push_back(j);
adj[j].push_back(i);
}
}
int m = 4, mx = 0;
for(int i = 1; i <= 2 * n; i++) {
int x = -1;
for(int j = 0; j < m; j++) if (!g[j][i]) {
x = j;
break;
}
assert(x >= 0);
mx = max(mx, x);
for(int &v : adj[i]) g[x][v] = 1;
}
assert(mx <= 2);
// cerr << mx << endl;
for(int i = 1; i <= 2 * n; i++) {
assert(adj[i].size() == 1 || adj[i].size() == 3);
if (adj[i].size() == 1) continue;
for(int &j : adj[i]) {
vector<int> tmp;
tmp.push_back(i);
for(int &k : adj[i]) if (k != j) tmp.push_back(k);
if (Query(tmp) == 1) {
love[i][j] = 1;
}
}
}
for(int i = 1; i <= 2 * n; i++) {
for(int &j : adj[i]) if (i < j && love[i][j] + love[j][i] == 0) {
Answer(i, j);
}
}
}
} // namespace
void Solve(int n) {
::solve(n);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Incorrect |
14 ms |
468 KB |
Wrong Answer [3] |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
1 ms |
344 KB |
Output is correct |
4 |
Runtime error |
1 ms |
600 KB |
Execution killed with signal 6 |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
1 ms |
344 KB |
Output is correct |
4 |
Runtime error |
1 ms |
600 KB |
Execution killed with signal 6 |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Incorrect |
14 ms |
480 KB |
Wrong Answer [3] |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Incorrect |
14 ms |
468 KB |
Wrong Answer [3] |
4 |
Halted |
0 ms |
0 KB |
- |