# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
839556 | model_code | Coreputer (IOI23_coreputer) | C++17 | 1 ms | 288 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.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) {
int resp = 0, p = 0;
vector <int> pre;
for (int i = 4; i >= 0; --i) {
int r = p + (1 << i);
pre.clear();
for (int j = 0; j < r; ++j) {
pre.push_back(j);
}
int res = ask(pre, N);
if (res < 0) {
p = r;
} else {
resp = res;
}
}
p++;
pre.clear();
for (int i = 0; i < p; ++i) {
pre.push_back(i);
}
vector <int> ans(N, 0);
for (int i = 0; i < N; ++i) {
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... |