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 "speedrun.h"
void assignHints(int subtask, int N, int A[], int B[]) {
setHintLen(N);
for (int i = 1; i < N; i++) {
setHint(A[i], B[i], 1);
setHint(B[i], A[i], 1);
}
}
int Idx[1001];
int Par[1001];
void speedrun(int subtask, int N, int start) {
for (int i = 1; i <= N; i++)
Idx[i] = 1;
int cur = start;
while (1) {
if (Idx[cur] > N) {
if (!Par[cur])
return;
goTo(Par[cur]);
cur = Par[cur];
}
if (Idx[cur] == Par[cur]) {
Idx[cur]++;
continue;
}
if (getHint(Idx[cur]++)) {
int nxt = Idx[cur] - 1;
Par[nxt] = cur;
goTo(nxt);
cur = nxt;
}
}
}
# | 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... |