Submission #909049

#TimeUsernameProblemLanguageResultExecution timeMemory
909049pavementCoreputer (IOI23_coreputer)C++17
80 / 100
1 ms596 KiB
#include "coreputer.h" #include <bits/stdc++.h> using namespace std; #define pb push_back vector<int> malfunctioning_cores(int N) { vector<int> mal(N); int lo = 0, hi = N - 1, ans = -1; while (lo <= hi) { int mid = (lo + hi) / 2; vector<int> qu_vec; for (int i = 0; i <= mid; i++) { qu_vec.pb(i); } if (run_diagnostic(qu_vec) == 1) { ans = mid; hi = mid - 1; } else { lo = mid + 1; } } assert(ans != -1); vector<int> qu_vec; for (int i = 0; i <= ans; i++) { qu_vec.pb(i); } for (int i = 0; i <= ans; i++) { qu_vec.erase(find(qu_vec.begin(), qu_vec.end(), i)); if (run_diagnostic(qu_vec) != 1) { mal[i] = 1; } qu_vec.pb(i); } qu_vec.pop_back(); for (int i = ans + 1; i < N; i++) { qu_vec.pb(i); if (run_diagnostic(qu_vec) == 1) { mal[i] = 1; } qu_vec.pop_back(); } return mal; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...