# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
908238 | zyq181 | Coreputer (IOI23_coreputer) | C++17 | 0 ms | 0 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.
#include "coreputer.h"
#include <bits/stdc++.h>
using namespace std;
int[] malfunctioning_cores(int N){
int num;
vector<int> them;
int cur;
bool flag = false;
int ret;
for(int a=1; a<=N; a++){
int arr[a];
cur = a-1;
for(int b=0; b<a; a++){
arr[b] = b;
}
ret = run_diagnostic(arr);
if(ret != -1){
flag = true;
them.push_back(b);
break;
}
}
int ar[cur + 1];
for(int a=0; a<cur; a++) ar[a] = a;
for(int a=cur+1; a<N; a++){
ar[cur] = a;
if(run_diagnostic(ar) != -1){
them.push_back(a);
}
}
int cmp = them.size(); //either half + 1 or half + 1/2
int k;
if(ret == 1){
num = cmp + cmp - 1; //cmp - 1
k = cmp;
}
else{
num = 2 * cmp - 2; //cmp - 2
k = cmp - 1;
}
int p[k];
for(int a=0; a<k-1; a++){
p[a] = them[a];
}
for(int a=0; a<cur; a++){
p[k-1] = a;
if(run_diagnostic(p) != -1){
them.push_back(a);
}
}
int r[num];
for(int a=0; a<num; a++){
r[a] = them[a];
}
return r;
}