답안 #909058

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
909058 2024-01-17T04:59:52 Z pavement Coreputer (IOI23_coreputer) C++17
0 / 100
1 ms 596 KB
#include "coreputer.h"
#include <bits/stdc++.h>
using namespace std;

#define pb push_back

vector<int> malfunctioning_cores(int N) {
	vector<int> mal(N);
	int lo = 0, hi = N - 1, ans = -1, ret = -1;
	while (lo <= hi) {
		int mid = (lo + hi) / 2;
		vector<int> qu_vec;
		for (int i = 0; i <= mid; i++) {
			qu_vec.pb(i);
		}
		int tmp = run_diagnostic(qu_vec);
		if (tmp >= 0) {
			ans = mid;
			ret = tmp;
			hi = mid - 1;
		} else {
			lo = mid + 1;
		}
	}
	assert(ans != -1);
	vector<int> qu_vec;
	for (int i = 0; i <= ans; i++) {
		qu_vec.pb(i);
	}
	for (int i = 0; i < ans; i++) {
		qu_vec.erase(find(qu_vec.begin(), qu_vec.end(), i));
		if (run_diagnostic(qu_vec) == -1) {
			mal[i] = 1;
		}
		qu_vec.pb(i);
	}
	mal[ans] = 1;
	qu_vec.pop_back();
	for (int i = ans + 1; i < N - 1; i++) {
		qu_vec.pb(i);
		if (run_diagnostic(qu_vec) >= 0) {
			mal[i] = 1;
		}
		qu_vec.pop_back();
	}
	int parity = count(mal.begin(), mal.end(), 1) % 2;
	mal.back() = (parity != ret);
	return mal;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Incorrect 1 ms 344 KB Incorrect
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 344 KB Output is correct
5 Correct 1 ms 596 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 Incorrect 0 ms 344 KB Incorrect
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Incorrect 1 ms 344 KB Incorrect
3 Halted 0 ms 0 KB -