Submission #707678

#TimeUsernameProblemLanguageResultExecution timeMemory
707678AdamGSLost in the cycle (IOI19_cycle)C++17
100 / 100
1 ms208 KiB
#include "cycle.h"
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(a, b) for(int a = 0; a < (b); ++a)
#define st first
#define nd second
#define pb push_back
#define all(a) a.begin(), a.end()
void escape(int n) {
	if(n==2) {
		jump(1);
		return;
	}
	bool x=jump(0);
	if(x) x=jump((n-1)/2);
	while(x) x=jump(1);
	int akt=n-1;
	int po=n-(n-1)/2, ko=n-1;
	while(po<ko) {
		int sr=(po+ko)/2;
		x=jump((sr-akt+n)%n);
		akt=sr;
		if(x) po=sr+1; else ko=sr;
	}
	jump((po-1-akt+2*n)%n);
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...