제출 #1024331

#제출 시각아이디문제언어결과실행 시간메모리
1024331byakkoLost in the cycle (IOI19_cycle)C++17
100 / 100
1 ms348 KiB
#include "cycle.h"

bool move(int& cur, int end, int n) {
	bool ans;
	if(cur <= end) ans = jump(end - cur);
	else ans = jump(n + end - cur);
	cur = end;
	return ans;
}

void escape(int n) {
	bool ini = jump(0);
	int cur = 0;
	int l = 0, r = n/2 + 1;
	while(l + 1 < r) {
		int m = (l + r) >> 1;
		if(move(cur, m, n) == ini) l = m;
		else r = m;
	}
	if(ini) move(cur, l, n);
	else {
		move(cur, r + n / 2, n);
	}
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...