Submission #1092415

#TimeUsernameProblemLanguageResultExecution timeMemory
1092415LuvidiCoreputer (IOI23_coreputer)C++17
90 / 100
1 ms344 KiB
#include "coreputer.h" #include <bits/stdc++.h> using namespace std; std::vector<int> malfunctioning_cores(int n) { int idx,s=1; int l=0,r=n-1; while(l<r){ int m=(l+r)/2; vector<int> v; for(int i=0;i<=m;i++)v.push_back(i); int x=run_diagnostic(v); if(x==-1)l=m+1; else{ r=m; s=x; } } idx=l; vector<int> ans(n); if(s){ vector<int> v; for(int i=0;i<idx;i++)v.push_back(i); ans[idx]=1; for(int i=idx+1;i<n;i++){ v.push_back(i); ans[i]=run_diagnostic(v)==1; v.pop_back(); } v.clear(); for(int i=idx+1;i<n;i++)v.push_back(i); for(int i=0;i<idx;i++){ v.push_back(i); ans[i]=run_diagnostic(v)==1; v.pop_back(); } }else{ vector<int> v; for(int i=0;i<=idx;i++)v.push_back(i); ans[idx]=1; for(int i=idx+1;i<n-1;i++){ v.push_back(i); ans[i]=run_diagnostic(v)==1; v.pop_back(); } v.clear(); for(int i=idx+1;i<n;i++)v.push_back(i); for(int i=0;i<idx;i++){ v.push_back(i); ans[i]=run_diagnostic(v)==1; v.pop_back(); } for(int i=0;i<n-1;i++)ans[n-1]^=ans[i]; } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...