Submission #912996

# Submission time Handle Problem Language Result Execution time Memory
912996 2024-01-20T05:08:54 Z penguin133 Coreputer (IOI23_coreputer) C++17
20 / 100
1 ms 596 KB
#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 time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 512 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 504 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 1 ms 344 KB Output is correct
12 Correct 1 ms 344 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
14 Correct 1 ms 596 KB Output is correct
15 Correct 1 ms 344 KB Output is correct
16 Incorrect 1 ms 344 KB Incorrect
17 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 1 ms 512 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 1 ms 344 KB Output is correct
9 Correct 1 ms 344 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 504 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
14 Correct 1 ms 344 KB Output is correct
15 Correct 1 ms 344 KB Output is correct
16 Correct 1 ms 344 KB Output is correct
17 Correct 1 ms 596 KB Output is correct
18 Correct 1 ms 344 KB Output is correct
19 Incorrect 1 ms 344 KB Incorrect
20 Halted 0 ms 0 KB -