Submission #1237522

#TimeUsernameProblemLanguageResultExecution timeMemory
1237522SG2AlokCave (IOI13_cave)C++20
33 / 100
17 ms520 KiB
#include "cave.h"
#include <bits/stdc++.h>
using namespace std;

auto seed = chrono::high_resolution_clock::now().time_since_epoch().count();
std::mt19937 mt(seed);

void exploreCave(int N) {
    int a[N], ans[N];
    for(int i = 0; i < N; i++) a[i] = mt()%2, ans[i] = -1;
    
    int cur = tryCombination(a);
    while(cur != -1){
    	for(int i = 0; i < N; i++){
    		if(ans[i] != -1) continue;
    		a[i] = 1 - a[i];
    		int judges = tryCombination(a);
    		if(judges == -1){
    			cur = judges;
    			break;
			}
    		if(judges < cur){
    			a[i] = 1 - a[i];
    			ans[i] = judges;
			} else if(judges > cur){
				ans[i] = judges;
				cur = judges;
			}
		}
	}
    
    for(int i = 0; i < N; i++){
		a[i] = 1 - a[i];
		ans[i] = tryCombination(a);
    	a[i] = 1 - a[i];
	}
	
	answer(a, ans);
}
#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...