Submission #467539

#TimeUsernameProblemLanguageResultExecution timeMemory
467539lordlorincCave (IOI13_cave)C++17
0 / 100
214 ms368 KiB
#include <bits/stdc++.h> #include "cave.h" using namespace std; // int main(){ // return 0; // } void exploreCave(int n) { int swiches[n], partners[n]; bool founded[n]; swiches[0] = 1; swiches[1] = 1; swiches[2] = 1; swiches[3] = 1; //cout << tryCombination(swiches) << " wdsvlkn" << endl; fill(founded, founded + n, false); fill(partners, partners + n, -1); for (int i = 0; i < n; i++) { int l = 0, r = n - 1; for (int j = 0; j < n; j++) { if (founded[j] == false) { swiches[j] = 0; } } int status = tryCombination(swiches) <= i; while (l != r){ int mid = (l + r) / 2; for (int j = l; j <= r; j++) { if (founded[j] == true) continue; if (j <= mid){ swiches[j] = status; } else{ swiches[j] = 1 - status; } } int comb = tryCombination(swiches); if (comb <= i && comb != -1){ l = mid + 1; } else r = mid; } swiches[l] = status; founded[l] = true; partners[l] = i; } answer(swiches, partners); }
#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...