Submission #988346

#TimeUsernameProblemLanguageResultExecution timeMemory
988346Muaath_5Cave (IOI13_cave)C++17
0 / 100
157 ms604 KiB
#include <bits/stdc++.h> #define ll long long #define pii pair<int, int> using namespace std; const int N = 2e5+1; #ifndef MUAATH_5 #include "cave.h" #endif int tryCombination(int c[]); void answer(int s[], int d[]); void exploreCave(int n) { int correct[n] = {}; int index[n] = {}; for (int i = 0; i < n; i++) { int open = (tryCombination(correct) == i ? 1 : 0); int l = 0, r = n-1; while (l < r) { const int mid = (l+r)/2; int cpy[n]; for (int i = 0; i < n; i++) cpy[i] = correct[i]; if (!open) { for (int i = mid+1; i < n; i++) cpy[i] = 1; } else { for (int i = 0; i <= mid; i++) cpy[i] = 1; } if (tryCombination(cpy) == i) l = mid+1; else r = mid; } index[i] = l; correct[l] = open; } int idx[n] = {}; for (int i = 0; i < n; i++) idx[index[i]] = i; answer(correct, idx); }
#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...