Submission #103728

#TimeUsernameProblemLanguageResultExecution timeMemory
103728turbatCave (IOI13_cave)C++14
100 / 100
1206 ms664 KiB
#include <bits/stdc++.h> #include "cave.h" using namespace std; void exploreCave(int N) { int a[N], s[N], d[N], found[N], l, r, t; memset(s, 0, sizeof s); memset(found, 0, sizeof found); for (int i = 0;i < N;i++){ for (int j = 0;j < N;j++) a[j] = s[j]; int tmp = tryCombination(a); if (tmp > i || tmp == -1) t = 0; else t = 1; l = 0, r = N - 1; while (l != r){ for (int i = 0;i < N;i++){ if (found[i]) a[i] = s[i]; else a[i] = 1 - t; } int mid = (l + r) / 2; for (int i = l;i <= mid;i++) if (!found[i]) a[i] = t; tmp = tryCombination(a); if (tmp > i || tmp == -1) r = mid; else l = mid + 1; } d[l] = i; found[l] = 1; s[l] = t; } 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...