Submission #912997

#TimeUsernameProblemLanguageResultExecution timeMemory
912997penguin133Coreputer (IOI23_coreputer)C++17
80 / 100
1 ms596 KiB
#include <bits/stdc++.h> using namespace std; #include "coreputer.h" //#define int long long #define pi pair<int, int> #define pii pair<int, pi> #define fi first #define se second #ifdef _WIN32 #define getchar_unlocked _getchar_nolock #endif mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count()); std::vector<int> malfunctioning_cores(int N) { int lo = 0, hi = N - 1, ans = -1, tmp = -1; while(lo <= hi){ int mid = (lo + hi) >> 1; vector <int> x; for(int j = 0; j <= mid; j++)x.push_back(j); int res = run_diagnostic(x); if(res == 1)hi = mid - 1; else ans = mid, tmp = res, lo = mid + 1; } if(ans == -1){ vector <int> x; x.push_back(1); for(int i = 0 ; i < N - 1; i++)x.push_back(0); return x; } assert(ans != N - 1); vector <int> bruh(N, 0); bruh[ans + 1] = 1; int ptr = ans + 1; if(tmp == -1)ptr++; for(int i = 0; i <= ans; i++){ vector <int> x; for(int j = 0; j <= i; j++)x.push_back(j); for(int j = ptr; j < N; j++)x.push_back(j); int res = run_diagnostic(x); if(res == 1){ bruh[i] = 1; if(ptr == ans + 1)ptr++; else { while(1){ ptr++; if(ptr == N){ bruh[N - 1] = 1; break; } x.clear(); for(int j = 0; j <= i; j++)x.push_back(j); for(int j = ptr; j < N; j++)x.push_back(j); int ret = run_diagnostic(x); if(ret != 1){ bruh[ptr - 1] = 1; break; } } } } } return bruh; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...