Submission #258955

#TimeUsernameProblemLanguageResultExecution timeMemory
258955mjkocijanLost in the cycle (IOI19_cycle)C++14
100 / 100
1 ms384 KiB
#include "cycle.h" using namespace std; #include <bits/stdc++.h> void escape(int n) { if (n == 2) { jump(1); return; } int lo = 0, hi = n - 1; int lst = 0; while (lo < hi) { int mid; if (hi - lo == n - 1) mid = (lo + hi + 1) / 2; else mid = (lo + hi) / 2; int dist; int kamo = mid - n / 2; if (kamo < 0) kamo += n; if (kamo >= lst) dist = kamo - lst; else dist = n - lst + kamo; int ret = jump(dist); //cout <<lo<<' '<<hi<<' '<<n<<'.'<<mid<<' '<<kamo<<' '<< dist<<' '<<ret<<endl; if (ret) hi = mid; else lo = mid + 1; lst = kamo; } int dist; if (lo > lst) dist = lo - lst; else dist = n - lst + lo; jump(dist); //cout<<lo<<' '<<dist<<endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...