Submission #403647

#TimeUsernameProblemLanguageResultExecution timeMemory
403647hltkCave (IOI13_cave)C++17
21 / 100
413 ms460 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) { cerr << query(s, 0, 0) << " " << query(s, 1, 0) << endl; int fill = query(s, 0, 0) > i; assert(query(s, fill, 0) <= i); for (int j = 1; j <= n; ++j) { if (query(s, fill, j) > i) { s[j - 1] = !fill; d[j - 1] = i; break; } } // int l = 0, r = n; // while (l < r) { // int m = (l + r) / 2; // vector<int> t(n); // for (int j = 0; j < n; ++j) { // if (d[j] == -1) t[j] = j < m; // else t[j] = d[j]; // } // if (query(t.data()) >= i) r = m; // else l = m + 1; // } // if (l > 0) d[l - 1] = 1; } 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...