제출 #1289007

#제출 시각아이디문제언어결과실행 시간메모리
1289007hiddenmeanings동굴 (IOI13_cave)C++20
0 / 100
2 ms340 KiB
#include <bits/stdc++.h> #include "cave.h" using namespace std; void exploreCave(int N) { int S[N], D[N]; bool used[N] = {false}; for (int door = 0; door < N; door++) { int comb[N] = {0}; // Try each unused switch to find which one controls this door for (int i = 0; i < N; i++) { if (used[i]) { comb[i] = S[i]; // already known state } else { comb[i] = 0; // test with switch i off } } int failingDoor = tryCombination(comb); int switchIndex = -1; for (int i = 0; i < N; i++) { if (used[i]) continue; comb[i] = 1; failingDoor = tryCombination(comb); if (failingDoor == door) { switchIndex = i; S[i] = 1; break; } comb[i] = 0; failingDoor = tryCombination(comb); if (failingDoor == door) { switchIndex = i; S[i] = 0; break; } } D[switchIndex] = door; used[switchIndex] = true; } 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...