# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
839557 | model_code | Coreputer (IOI23_coreputer) | C++17 | 1 ms | 248 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
// partially_correct/sol_db_N+logN-1.cpp
#include <bits/stdc++.h>
#include "coreputer.h"
using namespace std;
int ask(vector <int> q, int N) {
if (q.size() >= N) {
return 1;
} else if (q.empty()) {
return -1;
} else {
return run_diagnostic(q);
}
}
vector <int> malfunctioning_cores(int N) {
auto fill = [](int endp) {
vector <int> result;
for (int i = 0; i < endp; ++i) result.push_back(i);
return result;
};
int resp = 1, p = 0;
vector <int> pre;
for (int i = 3; i >= 0; --i) {
int r = p + (1 << i);
pre = fill(r);
int res = ask(pre, N);
if (res < 0) {
p = r;
} else {
resp = res;
}
}
pre = fill(++p);
vector <int> ans(N, 0);
for (int i = 0; i < N; ++i) {
if (i == p - 1) {
ans[i] = 1;
continue;
}
vector <int> simdiff = pre;
auto it = find(simdiff.begin(), simdiff.end(), i);
if (it != simdiff.end()) {
simdiff.erase(it);
ans[i] = ask(simdiff, N) != resp;
} else {
simdiff.pop_back();
simdiff.push_back(i);
ans[i] = ask(simdiff, N) == resp;
}
}
return ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |