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 "speedrun.h"
using namespace std;
void assignHints (int subtask, int n, int a[], int b[]) {
int deg[n + 1] = {};
if (n == 1) return;
for (int i = 1; i < n; i++) {
deg[a[i]]++;
deg[b[i]]++;
}
int pos = 1;
for (int i = 1; i <= n; i++) {
if (deg[i] > 1) {
pos = i;
}
}
setHintLen(1);
setHint(pos, 1, 1);
}
void speedrun (int subtask, int n, int start) {
if (n == 1) return;
int x = getHint(1);
if (x == 1) {
for (int i = 1; i <= n; i++) {
if (i == start) continue;
goTo(i); goTo(start);
}
return;
}
for (int i = 1; i <= n; i++) {
if (i == start) continue;
if (goTo(i)) {
for (int j = 1; j <= n; j++) {
if (j == i || j == start) continue;
goTo(j); goTo(i);
}
goTo(start);
return;
}
}
}
# | 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... |