Submission #1002243

#TimeUsernameProblemLanguageResultExecution timeMemory
1002243toast12Cave (IOI13_cave)C++14
33 / 100
269 ms976 KiB
#include <bits/stdc++.h> #include "cave.h" using namespace std; void exploreCave(int N) { int s[N], d[N]; set<int> a; for (int i = 0; i < N; i++) { s[i] = -1; d[i] = -1; a.insert(i); } // iterate over all doors and find out which switch opens the ith door for (int i = 0; i < N; i++) { // find which switch unlocks door i set<int> b = a; for (auto it = a.begin(); it != a.end(); it++) { int j = *it; if (s[j] != -1) continue; // try setting the current switch to down position s[j] = 0; int x = tryCombination(s); if (x == i+1 || x == -1) { // the current switch unlocks the current door d[j] = i; b.erase(b.find(j)); break; } // try setting the switch to up position s[j] = 1; x = tryCombination(s); if (x == i+1 || x == -1) { d[j] = i; b.erase(b.find(j)); break; } s[j] = -1; } swap(a, b); } answer(s, d); }
#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...