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 "icc.h"
#include <bits/stdc++.h>
using namespace std;
const int maxn = 105;
int n;
int ok[maxn][maxn];
int ask(vector<int> x, vector<int> y) {
int size_a = x.size(), size_b = y.size();
int a[size_a], b[size_b];
for(int i = 0; i < size_a; i++) a[i] = x[i];
for(int i = 0; i < size_b; i++) b[i] = y[i];
return query(size_a, size_b, a, b);
}
int chex(int u) {
vector<int> a = {u}, b;
for(int i = 1; i <= n; i++) {
if(i != u and !ok[u][i]) {
b.push_back(i);
}
}
if(b.empty()) return 0;
return ask(a, b);
}
int find_another(int u) {
for(int i = 1; i <= n; i++) {
if(i != u and !ok[u][i]) {
if(ask({u}, {i})) {
return i;
}
}
} assert(false);
}
void run(int N) {
memset(ok, 0, sizeof ok);
n = N;
while(true) {
int u = 0;
for(int i = 1; i <= n; i++)
if(chex(i)) { u = i; break; }
int v = find_another(u);
setRoad(u, v);
ok[u][v] = ok[v][u] = 1;
}
}
# | 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... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |