답안 #912536

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

vector<int> malfunctioning_cores(int N){
	vector<int> mal;
	vector<int> v;
	for(int a=0; a<N; a++) v.push_back(0);
	int lo = 0;
	int hi = N-1;
	bool flag = true;
	vector<int> q;
	int t;
	int numneed;
	while(lo < hi){
		q.clear();
		int m = (lo + hi)/2;
		for(int a=0; a<=m; a++){
			q.push_back(a);
		}
		t = run_diagnostic(q);
		if(t == 0) flag = false;
		if(t == -1) lo = m + 1;
		else hi = m;
	}
	mal.push_back(lo);
	for(int a=lo+1; a<=N-1; a++){
		q.pop_back();
		q.push_back(a);
		if(run_diagnostic(q) != -1){
			mal.push_back(a);
		}
	}
	if(flag) numneed = mal.size();
	else numneed = mal.size() - 1;
	q.clear();
	for(int a=0; a<numneed-1; a++){
		q.push_back(mal[a]);
	}
	for(int a=0; a<=lo-1; a++){
		q.push_back(a);
		if(run_diagnostic(q) != -1) mal.push_back(a);
		q.pop_back();
	}
	for(auto it: mal) v[it] = 1;
	return v;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 1 ms 344 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 0 ms 344 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Incorrect 1 ms 344 KB Incorrect
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 0 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 0 ms 344 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
14 Incorrect 1 ms 344 KB Incorrect
15 Halted 0 ms 0 KB -