답안 #1004813

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1004813 2024-06-21T16:52:15 Z thinknoexit Coreputer (IOI23_coreputer) C++17
20 / 100
0 ms 344 KB
#include "coreputer.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int n;
vector<int> malfunctioning_cores(int N) {
	n = N;
	int l = 0, r = n - 1;
	int parity = 1;
	while (l < r) {
		int mid = (l + r) / 2;
		vector<int> t;
		for (int i = 0;i <= mid;i++) t.push_back(i);
		int res = run_diagnostic(t);
		if (res >= 0) {
			r = mid;
			parity = min(parity, res);
		}
		else l = mid + 1;
	}
	vector<int> ans(n, 0);
	ans[l] = 1;
	int now = 1;
	if (l == n - 1) {
		return ans;
	}
	// trycheck
	for (int i = 0;i < l;i++) {
		vector<int> t;
		for (int j = 0;j <= l;j++) if (j != i) t.push_back(j);
		if (run_diagnostic(t) < 0) ans[l] = 1, now ^= 1;
	}
	for (int i = l + 1;i < n - 1;i++) {
		vector<int> t;
		for (int j = 0;j < l;j++) t.push_back(j);
		t.push_back(i);
		if (run_diagnostic(t) >= 0) ans[l] = 1, now ^= 1;
	}
	ans[n - 1] = now ^ parity;
	return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 0 ms 344 KB Incorrect
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 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 0 ms 344 KB Output is correct
5 Incorrect 0 ms 344 KB Incorrect
6 Halted 0 ms 0 KB -