Submission #230218

#TimeUsernameProblemLanguageResultExecution timeMemory
230218syyLost in the cycle (IOI19_cycle)C++17
0 / 100
5 ms384 KiB
#include "cycle.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define FOR(i, a, b) for(int i = (int)a; i <= (int)b; i++)
#define DEC(i, a, b) for(int i = (int)a; i >= (int)b; i--)
typedef pair<int, int> pi;
#define f first
#define s second
#define pb push_back
#define all(v) v.begin(), v.end()
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)

bool can;
int cur;

void escape(int n) {
	can = jump(0);
	if (can) {
		int lower = 0, upper = n/2+1;
		while (upper - lower > 1) {
			int mid = (upper + lower)/2;
			if (jump((mid-cur+n)%n)) lower = mid;
			else upper = mid;
			cur = mid;
		}
	} else {
		int lower = -1, upper = n/2;
		while (upper - lower > 1) {
			int mid = (upper + lower)/2;
			if (jump((mid-cur+n)%n)) upper = mid;
			else lower = mid;
			cur = mid;
		}
		jump((upper-cur+n+n/2)%n);
	}
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...