제출 #1260061

#제출 시각아이디문제언어결과실행 시간메모리
1260061Seyyed_Mojtaba_Mortazavi코알라 (APIO17_koala)C++20
컴파일 에러
0 ms0 KiB
#include "koala.h"
#include <bits/stdc++.h>

using namespace std;

const int MAXN = 5e5 + 10;

int minValue(int n, int w)
{
	int b[n];
	int r[n];
	memset(b, 0, sizeof(b));
	b[0] = 1;
	playRound(&b, &r);
	for (int i = 0; i < n; i++)
	{
		if (b[i] >= r[i])
			return i;
	}
}

int maxValue(int n, int w)
{
	return 0;
}

int greaterValue(int n, int w)
{
	return 0;
}

void allValues(int n, int w, int *p)
{

}

컴파일 시 표준 에러 (stderr) 메시지

koala.cpp: In function 'int minValue(int, int)':
koala.cpp:14:19: error: cannot convert 'int (*)[n]' to 'int*'
   14 |         playRound(&b, &r);
      |                   ^~
      |                   |
      |                   int (*)[n]
In file included from koala.cpp:1:
koala.h:4:21: note:   initializing argument 1 of 'void playRound(int*, int*)'
    4 | void playRound(int *B, int *R);
      |                ~~~~~^
koala.cpp:20:1: warning: control reaches end of non-void function [-Wreturn-type]
   20 | }
      | ^