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 <bits/stdc++.h>
#include "icc.h"
using namespace std;
vector < int > p;
int root(int a) {
if (p[a] == a) return a;
return p[a] = root(p[a]);
}
void join(int a, int b) {
p[root(a)] = root(b);
}
void run(int N) {
p = vector < int >(N);
for (int i = 0; i < N; ++i) {
p[i] = i;
}
for (int t = 1; t < N; ++t) {
bool founded = false;
for (int i = 0; i < N && !founded; ++i) {
for (int j = i + 1; j < N && !founded; ++j) {
if (root(i) == root(j)) continue;
int a[1] = {i + 1};
int b[1] = {j + 1};
if (query(1, 1, a, b)) {
setRoad(i + 1, j + 1);
join(i, j);
founded = true;
}
}
}
}
}
# | 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... |