Submission #838389

#TimeUsernameProblemLanguageResultExecution timeMemory
838389beabossLost in the cycle (IOI19_cycle)C++14
100 / 100
1 ms280 KiB
#include <bits/stdc++.h>
using namespace std;
bool jump(int x);
void escape(int n) {
	bool works = jump(0);

	while (!works) works = jump(n/2);

	int lo = 0;
	int hi = n/2;
	int cur_dist = 0;

	while (lo < hi) {
		
		int m = (lo + hi + 1)/2;

		if (jump((m - cur_dist + n) % n)) {
			lo = m;
		} else hi = m-1;

		cur_dist = m;
	}

	jump((lo - cur_dist + n) % n);

}

#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...