Submission #307940

#TimeUsernameProblemLanguageResultExecution timeMemory
307940kimjg1119Lost in the cycle (IOI19_cycle)C++17
100 / 100
1 ms384 KiB
#include "cycle.h" void escape(int n) { int le = 0, ri = n - 1; if (jump(0)) ri = n / 2; else le = n / 2 + 1; int h = 0; // x : 목표 지점 h : 현 위치 while (ri - le >= 2) { int mid = (le + ri) / 2; bool r = jump((mid - h + n) % n); h = (h + (mid - h + n) % n) % n; if (r) le = mid; else ri = mid - 1; } if (le == ri) { jump((le - h + n) % n); return; } if (le + 1 == ri) { bool r = jump((ri - h + n) % n); if (r) return; else jump(n - 1); } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...