답안 #908238

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
908238 2024-01-16T10:10:11 Z zyq181 Coreputer (IOI23_coreputer) C++17
컴파일 오류
0 ms 0 KB
#include "coreputer.h"
#include <bits/stdc++.h>
using namespace std;

int[] malfunctioning_cores(int N){
	int num;
	vector<int> them;
	int cur;
	bool flag = false;
	int ret;
	for(int a=1; a<=N; a++){
		int arr[a];
		cur = a-1;
		for(int b=0; b<a; a++){
			arr[b] = b;
		}
		ret = run_diagnostic(arr);
		if(ret != -1){
			flag = true;
			them.push_back(b);
			break;
		}
	}
	int ar[cur + 1];
	for(int a=0; a<cur; a++) ar[a] = a;
	for(int a=cur+1; a<N; a++){
		ar[cur] = a;
		if(run_diagnostic(ar) != -1){
			them.push_back(a);
		}
	}
	int cmp = them.size(); //either half + 1 or half + 1/2
	int k;
	if(ret == 1){
		num = cmp + cmp - 1; //cmp - 1
		k = cmp;
	}
	else{
		num = 2 * cmp - 2; //cmp - 2
		k = cmp - 1;
	}
	int p[k];
	for(int a=0; a<k-1; a++){	
		p[a] = them[a];
	}
	for(int a=0; a<cur; a++){
		p[k-1] = a;
		if(run_diagnostic(p) != -1){
			them.push_back(a);
		}
	}
	int r[num];
	for(int a=0; a<num; a++){
		r[a] = them[a];
	}
	return r;
}

Compilation message

coreputer.cpp:5:4: error: structured binding declaration cannot have type 'int'
    5 | int[] malfunctioning_cores(int N){
      |    ^~
coreputer.cpp:5:4: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
coreputer.cpp:5:4: error: empty structured binding declaration
coreputer.cpp:5:7: error: expected initializer before 'malfunctioning_cores'
    5 | int[] malfunctioning_cores(int N){
      |       ^~~~~~~~~~~~~~~~~~~~