Submission #369240

#TimeUsernameProblemLanguageResultExecution timeMemory
369240chienyu_xiongLost in the cycle (IOI19_cycle)C++17
100 / 100
1 ms384 KiB
#include "cycle.h" #include <bits/stdc++.h> using namespace std; /* bool jump(int dis) { return jump(dis); //tmp += dis; //tmp %= n; //return tmp == 0 || tmp > (n / 2); } */ void escape(int n) { auto amount = [](int src, int dst, int n) { return (dst - src + n) % n; }; bool val = jump(0); if (!val) { //cout << "debug" << endl; if (!jump((n + 1) / 2)) { jump(n - 1); return; } } int cur = 0; int lo = 0; int hi = n / 2; while (lo < hi) { int mid = (lo + hi + 1) / 2; int cng = amount(cur, mid, n); if (!jump(cng)) hi = mid - 1; else lo = mid; cur = mid; //cout << lo << " " << hi << ": " << cur << endl; } jump(amount(cur, lo, n)); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...