Submission #1130186

#TimeUsernameProblemLanguageResultExecution timeMemory
1130186PekibanLibrary (JOI18_library)C++17
0 / 100
20 ms416 KiB
#include <bits/stdc++.h> #include "library.h" using namespace std; void Solve(int n) { int f = 0; vector<int> a(n, 1); for (int i = 0; i < n; ++i) { a[i] = 0; if (Query(a) == 1) { f = i+1; break; } a[i] = 1; } vector<int> ans = {f}; for (int i = 1; i < n; ++i) { vector<int> S = a; while (1) { vector<int> S1(n, 0), S2(n, 0); int C = 0, t = 0, sz = 0; for (int j = 0; j < n; ++j) sz += S[j]; if (!sz) exit(0); for (int j = 0; j < n; ++j) { if (S[j]) { if (C < (sz+1)/2) S1[j] = 1, t = j+1; else { S2[j] = 1; } ++C; } } if (C == 1) { ans.push_back(t); if (t) a[t-1] = 0; break; } int x = Query(S1); S1[ans.back() - 1] = 1; if (Query(S1) > x) S = S2; else { S1[ans.back() - 1] = 0; S = S1; } } } Answer(ans); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...