Submission #167432

# Submission time Handle Problem Language Result Execution time Memory
167432 2019-12-08T14:40:46 Z nikatamliani Cave (IOI13_cave) C++14
0 / 100
583 ms 484 KB
# include "cave.h"
# include <bits/stdc++.h>
using namespace std;
void exploreCave(int N) {
	int fixed[N], ans[N];
	for(int i = 0; i < N; i ++)fixed[i] = -1;
    for(int i = 0; i < N; i ++){
    	int l = 0, r = N - 1;
    	int cur_x[N], res = 0;
    	bool open;
    	for(int j = 0; j < N; j ++)if(fixed[j] == -1)cur_x[j] = 1; else cur_x[j] = fixed[j];
    	int p = tryCombination(cur_x);
    	if(p > i || p == -1) open = 1;
    	else open = 0;
    	while(l < r){
    		int m = (l + r) >> 1;
    		for(int j = l; j <= m; j ++) if(fixed[j] == -1) cur_x[j] = open; else cur_x[j] = fixed[j]; 
    		for(int j = 0; j < N; j ++) if(j < l || j > r){if(fixed[j] == -1) cur_x[j] = open ^ 1; else cur_x[j] = fixed[j];}
    		int p = tryCombination(cur_x);
    		if(p > i || p == -1){
    			r = m;
			}else{
				l = m + 1;
			}
		}
		res = l;
		ans[res] = i;
		fixed[res] = open;
	}
	answer(fixed, ans);
}
# Verdict Execution time Memory Grader output
1 Incorrect 223 ms 484 KB Answer is wrong
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 583 ms 384 KB Answer is wrong
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 6 ms 384 KB Output is correct
2 Incorrect 6 ms 384 KB Answer is wrong
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 6 ms 384 KB Output is correct
2 Incorrect 6 ms 384 KB Answer is wrong
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 223 ms 484 KB Answer is wrong
2 Halted 0 ms 0 KB -