제출 #1277362

#제출 시각아이디문제언어결과실행 시간메모리
1277362almazCave (IOI13_cave)C++20
13 / 100
7 ms520 KiB
#include "cave.h"
#include <bits/stdc++.h>
using namespace std;

// #define int long long
// #define endl '\n'
#define ff first
#define ss second
#define pb push_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define ar array

const int MOD = 1e9 + 7,INF = 1e9, N = 2e5 + 5;
/*
*/

void exploreCave(int n){
    int ans[n];
    for(int i = 0;i < n;i++){
		ans[i] = 0;
	}
	int s[n];
	
	vector <int> use(n);
	
    for(int i = 0;i < n;i++){
		int x = tryCombination(ans);
		if(x == -1){
			break;
		}
		int l = 0, r = n - 1;
		while(l < r){
			int m = (l + r) >> 1;
			
			if(ans[m]){
				l = m + 1;
				continue;
			}
			ans[m] = 1;
			int y = tryCombination(ans);
			ans[m] = 0;
			if(y > x|| y == -1){
				ans[m] = 1;
				break;
			}
			else if(y < x){
				l = m + 1;
			}
			else{
				r = m - 1;
			}
		}
	}
	
	for(int i = 0;i < n;i++){
		ans[i] = abs(ans[i] - 1);
		int x = tryCombination(ans);
		ans[i] = abs(ans[i] - 1);
		s[i] = x;
	}
	
	answer(ans, s);
}
#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...