This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 <= 3);
// 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 |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |