Submission #798598

#TimeUsernameProblemLanguageResultExecution timeMemory
798598LiudasCave (IOI13_cave)C++17
100 / 100
256 ms460 KiB
#include <bits/stdc++.h> #include "cave.h" using namespace std; void exploreCave(int N){ bool lock[N] = {0}; int ans[N] = {0}; int check[N] = {0}; for(int i = 0; i < N; i ++){ for(int j = 0; j < N; j ++){ if(!lock[j]){ check[j] = 0; } } int sign = 0, op; int t = tryCombination(check); if(t > i || t < 0){ sign = 0; } else{ sign = 1; } op = abs(sign - 1); int l = 0, r = N; //cout << "beg " << i << endl; while(l + 1 < r){ int mid = (l + r+1) / 2; for(int j = l; j < mid; j ++){ if(!lock[j])check[j]=sign; } for(int j = mid; j < r; j ++){ if(!lock[j])check[j]=op; } int a = tryCombination(check); if(a <= i && a >= 0){ l = mid; } else{ r = mid; } } lock[l] = true; ans[l] = i; check[l] = sign; } answer(check, 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...