Submission #134363

#TimeUsernameProblemLanguageResultExecution timeMemory
134363arthurconmyCave (IOI13_cave)C++14
33 / 100
215 ms512 KiB
#include <bits/stdc++.h>
using namespace std;

#ifndef ARTHUR_LOCAL
	#include "cave.h"
#endif

void exploreCave(int n)
{
	int D[n]; // we need to answer these
	int S[n];

	for(int i=0; i<n; i++)
	{
		S[i]=0;
		D[i]=0;
	}

	vector<bool> lock(n);

	for(int i=0; i<n; i++) // work out door i
	{
		int cur = tryCombination(S); // should be >= i unless it's -1

		for(int j=0; j<n; j++) // mess with switch j
		{
			if(lock[j]) continue;
		
			S[j]=1-S[j];
			
			int new_thing = tryCombination(S);

			if((cur==i && new_thing!=i) || (cur!=i && new_thing==i))
			{
				if(new_thing==i) S[j]=1-S[j];
				D[j]=i;
				lock[j]=1;
				break;
			}

			else S[j]=1-S[j];
		}
	}

	answer(S,D);
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...