답안 #908416

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
908416 2024-01-16T11:58:26 Z zyq181 Coreputer (IOI23_coreputer) C++17
컴파일 오류
0 ms 0 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;
	}
	them.push_back(lo);
	for(int a=0; a<lo; a++){
		q.clear();
		for(int b=0; b<=lo; b++) if(a != b) q.push_back(b)
		if(run_diagnostic(q) == -1){
			them.push_back(a);
		}
	}
	for(int a=lo+1; a<N; a++){
		q.clear();
		for(int b=0; b<lo; b++) q.push_back(b);
		q.push_back(a);
		if(run_diagnostic(q) != -1) q.push_back(a); 
	}
	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;
}

Compilation message

coreputer.cpp: In function 'std::vector<int> malfunctioning_cores(int)':
coreputer.cpp:25:53: error: expected ';' before 'if'
   25 |   for(int b=0; b<=lo; b++) if(a != b) q.push_back(b)
      |                                                     ^
      |                                                     ;
   26 |   if(run_diagnostic(q) == -1){
      |   ~~