Submission #912545

#TimeUsernameProblemLanguageResultExecution timeMemory
912545zyq181Coreputer (IOI23_coreputer)C++17
0 / 100
1 ms344 KiB
#include "coreputer.h" #include <bits/stdc++.h> using namespace std; vector<int> malfunctioning_cores(int N){ vector<int> mal; vector<int> v; for(int a=0; a<N; a++) v.push_back(0); int lo = 0; int hi = N-1; bool flag = 1; vector<int> q; int t; int numneed; while(lo < hi){ q.clear(); int m = (lo + hi)/2; for(int a=0; a<=m; a++){ q.push_back(a); } t = run_diagnostic(q); if(t == 0) flag = 0; if(t == -1) lo = m + 1; else hi = m; } mal.push_back(lo); if(lo == 0){ if(flag) { v[0] = 1; return v; } else{ v[0] = 1; for(int a=1; a<=N-2; a++){ q.clear(); q.push_back(a); if(run_diagnostic(q) == 0){ v[a] = 1; return v; } } v[N-1] = 1; return v; } } q.clear(); for(int a=0; a<=lo; a++) q.push_back(a); for(int a=lo+1; a<=N-1; a++){ q.pop_back(); q.push_back(a); if(run_diagnostic(q) != -1){ mal.push_back(a); } } if(flag) numneed = mal.size(); else numneed = mal.size() - 1; q.clear(); for(int a=0; a<numneed-1; a++){ q.push_back(mal[a]); } for(int a=0; a<=lo-2; a++){ q.push_back(a); if(run_diagnostic(q) != -1) mal.push_back(a); q.pop_back(); } int k = mal.size(); if((k%2) == flag) mal.push_back(lo - 1); for(auto it: mal) v[it] = 1; return v; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...