제출 #1160908

#제출 시각아이디문제언어결과실행 시간메모리
1160908Nurislam동굴 (IOI13_cave)C++20
12 / 100
36 ms516 KiB
#include <bits/stdc++.h>
#include "cave.h"
//#include "grader.c"

using namespace std;


void exploreCave(int n) {
	int ans1[n], ans2[n];
	for(int &i : ans1) i = 0;
	
	
	for(int i = 0; i+1 < n; i ++ ) {
		set<int> st[2];
		
		for(int x = 0; x < 2; x ++ )
			for(int y = 0; y < 2; y ++ ){
				ans1[ i ] = x;
				ans1[i+1] = y;
				st[x].insert(tryCombination(ans1));
			}
		
		for(int x = 0; x < 2; x ++ ){
			if(st[x].size() == 1)
				ans2[i] = *st[x].begin();
			else ans1[i] = x;
		}
		
	};
	int la = 0;
	for(int x = 0; x < 2; x ++ ){
		ans1[n-1] = x;
		int va = tryCombination(ans1);
		if(va == -1) la = x;
		else ans2[n-1] = va;
	};
	ans1[n-1] = la;
	
	int ans3[n-1];
	for(int i = 0; i < n; i ++ )ans3[i] = ans1[i];
	
	for(int i = n-1; i >= 0; i -- ){
		ans3[i] ^= 1;
		ans2[i] =  tryCombination(ans3);
	}
	answer(ans1, ans2);
};
#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...