Submission #1004814

#TimeUsernameProblemLanguageResultExecution timeMemory
1004814thinknoexitCoreputer (IOI23_coreputer)C++17
100 / 100
1 ms344 KiB
#include "coreputer.h" #include <bits/stdc++.h> using namespace std; using ll = long long; int n; vector<int> malfunctioning_cores(int N) { n = N; int l = 0, r = n - 1; int parity = 1; while (l < r) { int mid = (l + r) / 2; vector<int> t; for (int i = 0;i <= mid;i++) t.push_back(i); int res = run_diagnostic(t); if (res >= 0) { r = mid; parity = min(parity, res); } else l = mid + 1; } vector<int> ans(n, 0); ans[l] = 1; int now = 1; if (l == n - 1) { return ans; } // trycheck for (int i = 0;i < l;i++) { vector<int> t; for (int j = 0;j <= l;j++) if (j != i) t.push_back(j); if (run_diagnostic(t) < 0) ans[i] = 1, now ^= 1; } for (int i = l + 1;i < n - 1;i++) { vector<int> t; for (int j = 0;j < l;j++) t.push_back(j); t.push_back(i); if (run_diagnostic(t) >= 0) ans[i] = 1, now ^= 1; } ans[n - 1] = now ^ parity; return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...