Submission #913007

#TimeUsernameProblemLanguageResultExecution timeMemory
913007penguin133Coreputer (IOI23_coreputer)C++17
100 / 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 std::vector<int> malfunctioning_cores(int N) { int lo = 0, hi = N - 2, ans = -1, cnt = 0, lmao[16]; for(int i = 0; i < N; i++)lmao[i] = 5; 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); cnt++; //cout << mid << ' '; lmao[mid] = res; if(res == 1)hi = mid - 1; else ans = mid, lo = mid + 1; } //cout << cnt << ' ' << ans << '\n'; 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(lmao[ans] == -1)ptr++; //cout << ans << ' ' << cnt << '\n'; if(ans == N - 2 && lmao[ans] == 0){ //cout << "hi\n"; vector <int> x; for(int i = 0; i < ans; i++){ x.clear(); x.push_back(i); cnt++; if(run_diagnostic(x) == 0){ bruh[i] = 1; return bruh; } } bruh[N - 2] = 1; return bruh; } for(int i = 0; i <= ans; i++){ if(ptr == N)break; 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(ptr < N){ ptr++; if(ptr == N){ bruh[N - 1] = 1; break; } //cout << ptr << ' '; 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...