Submission #403652

#TimeUsernameProblemLanguageResultExecution timeMemory
403652hltkCave (IOI13_cave)C++17
100 / 100
1048 ms452 KiB
#include <bits/stdc++.h> using namespace std; #include "cave.h" void exploreCave(int n) { auto query = [&](vector<int> x, int fill, int lim) { for (int i = 0; i < n; ++i) { if (x[i] == -1) x[i] = i < lim ? !fill : fill; } int ret = tryCombination(x.data()); return ret == -1 ? n : ret; }; vector<int> s(n, -1); vector<int> d(n, -1); for (int i = 0; i < n; ++i) { int fill = query(s, 0, 0) > i; int l = 1, r = n; while (l < r) { int m = (l + r) / 2; if (query(s, fill, m) > i) r = m; else l = m + 1; } s[l - 1] = !fill; d[l - 1] = i; } answer(s.data(), d.data()); }
#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...