Submission #908240

# Submission time Handle Problem Language Result Execution time Memory
908240 2024-01-16T10:11:33 Z zyq181 Coreputer (IOI23_coreputer) C++17
Compilation error
0 ms 0 KB
#include "coreputer.h"
#include <bits/stdc++.h>
using namespace std;

vector<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);
		}
	}
	return them;
}

Compilation message

coreputer.cpp: In function 'std::vector<int> malfunctioning_cores(int)':
coreputer.cpp:17:24: error: could not convert '(int*)(& arr)' from 'int*' to 'std::vector<int>'
   17 |   ret = run_diagnostic(arr);
      |                        ^~~
      |                        |
      |                        int*
coreputer.cpp:20:19: error: 'b' was not declared in this scope
   20 |    them.push_back(b);
      |                   ^
coreputer.cpp:28:21: error: could not convert '(int*)(& ar)' from 'int*' to 'std::vector<int>'
   28 |   if(run_diagnostic(ar) != -1){
      |                     ^~
      |                     |
      |                     int*
coreputer.cpp:48:21: error: could not convert '(int*)(& p)' from 'int*' to 'std::vector<int>'
   48 |   if(run_diagnostic(p) != -1){
      |                     ^
      |                     |
      |                     int*