This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "coreputer.h"
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
vector<int> malfunctioning_cores(int N) {
vector<int> mal(N);
int lo = 0, hi = N - 1, ans = -1;
while (lo <= hi) {
int mid = (lo + hi) / 2;
vector<int> qu_vec;
for (int i = 0; i <= mid; i++) {
qu_vec.pb(i);
}
if (run_diagnostic(qu_vec) == 1) {
ans = mid;
hi = mid - 1;
} else {
lo = mid + 1;
}
}
assert(ans != -1);
vector<int> qu_vec;
for (int i = 0; i <= ans; i++) {
qu_vec.pb(i);
}
for (int i = 0; i <= ans; i++) {
qu_vec.erase(find(qu_vec.begin(), qu_vec.end(), i));
if (run_diagnostic(qu_vec) != 1) {
mal[i] = 1;
}
qu_vec.pb(i);
}
qu_vec.pop_back();
for (int i = ans + 1; i < N; i++) {
qu_vec.pb(i);
if (run_diagnostic(qu_vec) == 1) {
mal[i] = 1;
}
qu_vec.pop_back();
}
return mal;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |