Submission #939815

#TimeUsernameProblemLanguageResultExecution timeMemory
939815AdamGSCoreputer (IOI23_coreputer)C++17
100 / 100
1 ms600 KiB
#include "coreputer.h" #include<bits/stdc++.h> using namespace std; #define rep(a, b) for(int a = 0; a < (b); ++a) #define st first #define nd second #define pb push_back #define all(a) a.begin(), a.end() vector<int>malfunctioning_cores(int n) { bool zero=false; vector<int>ans(n); int po=1, ko=n; int ile=0; while(po<ko) { int sr=(po+ko)/2; vector<int>P; rep(j, sr) P.pb(j); int x=run_diagnostic(P); ++ile; if(x==0) zero=true; if(x==-1) po=sr+1; else ko=sr; } ans[po-1]=1; if(po==n) return ans; rep(i, po-1) { vector<int>P; rep(j, po) if(j!=i) P.pb(j); int x=run_diagnostic(P); ++ile; if(x==0) zero=true; if(x==-1) ans[i]=1; } for(int i=po; i<n-1; ++i) { vector<int>P; rep(j, po-1) P.pb(j); P.pb(i); int x=run_diagnostic(P); ++ile; if(x==0) zero=true; if(x!=-1) ans[i]=1; } if(ile<18) { vector<int>P; rep(j, po) P.pb(j); int x=run_diagnostic(P); ++ile; if(x==0) zero=true; } int sum=0; for(auto i : ans) sum^=i; if(sum==zero) ans[n-1]=1; return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...