Submission #225908

#TimeUsernameProblemLanguageResultExecution timeMemory
225908pavementLost in the cycle (IOI19_cycle)C++17
100 / 100
5 ms384 KiB
#include "cycle.h" #include <bits/stdc++.h> using namespace std; void escape(int n) { if (n == 2) { jump(1); return; } int cur = 0, lo = 0, hi = n / 2, ans = -1; if (jump(n - 1)) { if (!jump(1)) { jump(n - 1); return; } while (lo <= hi) { int mid = (lo + hi) >> 1; bool x = jump(mid <= cur ? cur - mid : n - llabs(cur - mid)); cur = mid; if (x) ans = mid, lo = mid + 1; else hi = mid - 1; } jump((ans <= cur ? cur - ans : n - llabs(cur - ans)) + n / 2); } else { jump(1); while (lo <= hi) { int mid = (lo + hi) >> 1; bool x = jump(mid >= cur ? mid - cur : n - cur + mid); cur = mid; if (x) ans = mid, hi = mid - 1; else lo = mid + 1; } jump((ans >= cur ? ans - cur : n - cur + ans) + n / 2); } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...