Submission #213190

#TimeUsernameProblemLanguageResultExecution timeMemory
213190_Ice_Tea_Lost in the cycle (IOI19_cycle)C++14
100 / 100
5 ms512 KiB
#include<bits/stdc++.h>
#include "cycle.h"
#define de(x) if( x && x == MODE)
#define MODE 0
int N;
int now;

void BS( int L, int R)
{
	de(1) printf("( %d, %d)\n", L, R);


	int M = ( L + R + 1) / 2;
	bool q;
	int j;
	if( now <= M)
	{
		j = M - now;
	}
	else
	{
		j = N - now + M;
	}

	q = jump( j);
	de(1) printf("jump(%d)\n", j);
	now = M;
	de(1) printf("pos. %d\n", now);

	if( L == R)
		return;

	if(q)
		BS( M, R);
	else
		BS( L, M-1);
}

void escape(int n) {
	now = 0;
	N = n;

	if( !jump(0) )
	{
		de(1) printf("jump(%d)\n", N/2);
		jump(N/2);
	}
	else
	{
		if( !jump(1) )
		{
			jump(n-1);
			return;
		}
		jump(n-1);
	}

	BS( 0,  n-1);
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...