Submission #871544

#TimeUsernameProblemLanguageResultExecution timeMemory
871544TAhmed33Speedrun (RMI21_speedrun)C++17
8 / 100
13 ms1792 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...