답안 #908366

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
908366 2024-01-16T11:31:56 Z zyq181 Coreputer (IOI23_coreputer) C++17
0 / 100
1 ms 344 KB
#include "coreputer.h"
#include <bits/stdc++.h>
using namespace std;

vector<int> malfunctioning_cores(int N){
	vector<int> them;
	int lo = 0;
	int hi = N - 1;
	vector<int> q;
	bool flag = false;
	while(lo < hi){
		int m = (lo + hi)/2;
		q.clear();
		for(int a=0; a<=m; a++) q.push_back(a);
		int t = run_diagnostic(q);
		if(t == 0) flag = true;
		if(t == -1){
			lo = m + 1;
		}
		else hi = m;
	}
	if(lo == 0){
		vector<int> tt;
		tt.push_back(1);
		for(int a=1; a<N; a++) tt.push_back(0);
		return tt;
	}
	them.push_back(lo);
	q.clear();
	for(int a=0; a<=lo-1; a++) q.push_back(a);
	for(int a=lo+1; a<N; a++){
		q.push_back(a);
		if(run_diagnostic(q) != -1) them.push_back(a);
		q.pop_back();
	}
	int k = them.size();
	if(flag){
		k--;
	}
	q.clear();
	for(int a=0; a<k-1; a++) q.push_back(them[a]);
	for(int a=0; a<=lo-2; a++) {
		q.push_back(a);
		if(run_diagnostic(q) != -1) them.push_back(a);
		q.pop_back();
	}
	if(((int)them.size() % 2) == flag){
		them.push_back(lo - 1);
	}
	vector<int> r;
	sort(them.begin(), them.end(), greater<int>());
	for(int a=0; a<N; a++){
		if(them.back() == a){
			r.push_back(1);
			them.pop_back();
		}
		else{
			r.push_back(0);
		}
	}
	return r;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Incorrect 0 ms 344 KB Incorrect
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 344 KB Incorrect
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Incorrect 0 ms 344 KB Incorrect
4 Halted 0 ms 0 KB -