제출 #1329512

#제출 시각아이디문제언어결과실행 시간메모리
132951212345678Coreputer (IOI23_coreputer)C++17
80 / 100
1 ms412 KiB
#include "coreputer.h"
#include <bits/stdc++.h>

using namespace std;

std::vector<int> malfunctioning_cores(int N) {
	int l=0, r=N-1, cnt1=0, cnt2=0;
	vector<int> res(N), v(N);
	while (l<r)
	{
		int md=(l+r)/2;
		vector<int> qrs;
		for (int i=0; i<=md; i++) qrs.push_back(i);
		if ((v[md]=run_diagnostic(qrs))>=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> qrs;
        for (int j=0; j<=l; j++) if (j!=i) qrs.push_back(j);
        if (run_diagnostic(qrs)<0) res[i]=1; 
    }
    for (int i=l+1; i<N; i++)
    {
        vector<int> qrs;
        for (int j=0; j<l; j++) qrs.push_back(j);
        qrs.push_back(i);
        if (run_diagnostic(qrs)>=0) res[i]=1;
    }
	return res;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...