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 "meetings.h"
#include <bits/stdc++.h>
using namespace std;
int sz[500];
int o[500];
vector<int> chil[500];
void Solve(int N) {
sz[0] = N;
for (int i = 1; i < N; i++) {
for (int j = 1; j < N; j++) {
if (i == j) continue;
if (Query(0, i, j) == i) {
sz[i]++;
chil[i].push_back(j);
}
}
o[i] = i;
}
// for (int i = 1; i < N; i++) {
// for (int c : chil[i]) cout << c << ' ';
// cout << '\n';
// }
sort(o, o + N, [&](int i, int j) { return sz[i] < sz[j]; });
bool us[N] = {};
for (int cur : o) {
for (int v : chil[cur]) {
if (us[v]) continue;
us[v] = true;
if (cur < v)
Bridge(cur, v);
else
Bridge(v, cur);
}
}
for (int i = 1; i < N; i++) if (!us[i])
Bridge(0, i);
}
# | 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... |