제출 #1025224

#제출 시각아이디문제언어결과실행 시간메모리
1025224HD1Lost in the cycle (IOI19_cycle)C++14
100 / 100
1 ms424 KiB
#include "cycle.h"
#include<bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(0); cin.tie(0);
using namespace std;
typedef long long ll;
typedef pair<ll,ll> ii;
const ll MAX=1e6;
const ll INF=1e17;
const ll mod=1e9+7;
bool mover(int&pos, int end, int n){
	bool ans;
	//cout<<pos<<' '<<end<<'\n';
	if(pos<=end)ans=jump(end-pos);
	else{
		//cout<<n<<' '<<pos<<' '<<end<<'\n';
		ans=jump(n-pos+end);
	}
	pos=end;
	return ans;
}
void escape(int n) {
	bool first=jump(0);
	int pos=0;
	int lo=0,hi=n/2+1;
	while(lo+1!=hi){
		ll mid=(lo+hi)/2;
		if(mover(pos, mid, n)==first){
			lo=mid;
		}
		else{
			hi=mid;
		}
	}
	if(first){
		mover(pos, lo, n);
	}
	else{
		mover(pos,hi+n/2, n);
	}


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