Submission #1331724

#TimeUsernameProblemLanguageResultExecution timeMemory
1331724ninstroyerCoreputer (IOI23_coreputer)C++20
80 / 100
1 ms412 KiB
#include "coreputer.h"
#include <bits/stdc++.h>
using namespace std;

std::vector<int> malfunctioning_cores(int n) 
{
	vector<int> res(n);
	int l = 0, r = n-1;
	while(l<r)
	{
		int md = (l+r)/2;
		vector<int> check;
		for(int i = 0; i <= md; i++) check.push_back(i);
		if(run_diagnostic(check) >= 0) r = md;
		else l = md+1;
	}
	res[l]=1;
	if(l==n-1) return res;
	for(int i = 0; i < l; i++)
	{
		vector<int> check;
		for(int j = 0; j <= l; j++) if(j!=i) check.push_back(j);
		if(run_diagnostic(check) >= 0) res[i]=0;
		else res[i]=1;
	}
	for(int i = l+1; i < n; i++)
	{
		vector<int> check;
		for(int j = 0; j < l; j++) check.push_back(j);
		check.push_back(i);
		if(run_diagnostic(check) >= 0) res[i]=1;
	}
	return res;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...