Submission #30043

# Submission time Handle Problem Language Result Execution time Memory
30043 2017-07-21T18:57:51 Z ozaslan Cave (IOI13_cave) C++14
0 / 100
98 ms 512 KB
#include "cave.h"
#define max_N 5005

int kul[max_N], S[max_N], D[max_N];

void degis(int sol, int orta) {
	for(int i = sol; i <= orta; i++)
		if(!kul[i])
			S[i] = (S[i]+1) %2;
}

void exploreCave(int N) {

	for(int i = 0; i < N; i++) {

		int sol = 0, sag = N+1;
		int kapi = tryCombination(S);
		int acik = kapi > i || kapi == -1 ? 1: 0;

		while(sol != sag) {
			int orta = (sol + sag) / 2;
			degis(sol, orta);
			kapi = tryCombination(S);
			int sonra = kapi > i || kapi == -1 ? 1: 0;
			degis(sol, orta);
		
			if(sonra != acik)
				sag = orta;
			else
				sol = orta+1;
		}

		kul[sol] = 0;
		S[sol] = acik;
		D[sol] = i;
 
	}


	answer(S, D);
}
# Verdict Execution time Memory Grader output
1 Incorrect 63 ms 468 KB Answer is wrong
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 98 ms 384 KB Answer is wrong
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 512 KB Answer is wrong
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 512 KB Answer is wrong
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 63 ms 468 KB Answer is wrong
2 Halted 0 ms 0 KB -