제출 #1271820

#제출 시각아이디문제언어결과실행 시간메모리
1271820orgiloogii동굴 (IOI13_cave)C++20
0 / 100
161 ms520 KiB
#include "cave.h" #include <bits/stdc++.h> using namespace std; void exploreCave(int N) { int fin[N] = {0}; int switches[N] = {0}; int doors[N] = {0}; for (int i = 0;i < N;i++) { fin[i] = -1; } for (int i = 0;i < N;i++) { for (int j = 0;j < N;j++) { if (fin[i] == -1) { switches[i] = 0; } else { switches[i] = fin[i]; } } int temp = tryCombination(switches); int curr; if (temp > i || temp == -1) { curr = 1; } else { curr = 0; } int l = 0,r = N, ind; while (l + 1 < r) { int mid = (l + r) / 2; for (int j = 0;j <= mid;j++) { if (fin[j] != -1) { switches[i] = fin[j]; } else { switches[i] = curr^1; } } for (int j = 0;j < N;j++) { if (fin[j] != -1) { switches[i] = fin[j]; } else { switches[i] = curr; } } int t = tryCombination(switches); if (t > i || t == -1) { r = mid; ind = r; } else { ind = l; } } fin[ind] = curr ^ 1; doors[ind] = i; } answer(fin, doors); } //int main() { // //}
#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...