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"
std::vector<int> malfunctioning_cores(int N) {
std::vector<int> c;
if(run_diagnostic(c)==0) return std::vector<int>(N,0);
int mal = -1;
int a;
for(int i = 0; i < N; i++)
{
c.push_back(i);
a = run_diagnostic(c);
if(a!=-1)
{
mal = i;
break;
}
}
std::vector<int> malfunc(N);
malfunc[mal] = 1;
for(int i = mal+1; i < N; i++)
{
c.pop_back();
c.push_back(i);
if(run_diagnostic(c)==a) malfunc[i] = true;
}
c.pop_back();
c.push_back(mal);
for(int i = 0; i < mal; i++)
{
auto j = c.begin();
for(;*j !=i; j++);
c.erase(j);
if(run_diagnostic(c)!=a) malfunc[i] = true;
c.push_back(i);
}
return malfunc;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |