Submission #912996

#TimeUsernameProblemLanguageResultExecution timeMemory
912996penguin133Coreputer (IOI23_coreputer)C++17
20 / 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, 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++; 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(ptr + 1 < N){ ptr++; //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; } } if(ptr + 1 == N)bruh[N - 1] = 1; } } } return bruh; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...