Submission #490244

#TimeUsernameProblemLanguageResultExecution timeMemory
490244PiejanVDCLost in the cycle (IOI19_cycle)C++17
0 / 100
0 ms200 KiB
#include <bits/stdc++.h> #include "cycle.h" using namespace std; bool jump(int x); int pp=5; void escape(int n) { int rem=0; for(int i = n/2 ; i >= 1 ; i/=2) { //cout << pp << " " << rem << "\n"; if(!jump(i + rem)) { rem = n - i; } else rem=0; } if(!jump(0)) jump(n-1); } /* //#include "cycle.h" #include <cstdio> #include <cassert> #include <string> using namespace std; static const int cnt_lim = 35; static int n, p, cnt; [[noreturn]] inline static void wrong_answer(string reason) { printf("%s\n", reason.c_str()); fclose(stdout); exit(0); } bool jump(int x) { pp+=x; pp%=n; if (x < 0 || x >= n) wrong_answer("Invalid argument."); cnt++; if (cnt > cnt_lim) wrong_answer("Too many queries."); p = (p + x) % n; return (n - p) % n <= n / 2; } int main() { assert(1 == scanf("%d", &n)); assert(1 == scanf("%d", &p)); fclose(stdin); cnt = 0; escape(n); if (p != 0) wrong_answer("The exit was not found."); printf("OK\n"); fprintf(stderr, "%d\n", cnt); fclose(stdout); return 0; }*/
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...