답안 #1004790

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1004790 2024-06-21T15:36:53 Z magikarp23 말 (IOI15_horses) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
#include "horses.h"
using namespace std;

int MAX_N = 500'000 + 1;
long long MOD = 1'000'000'000 + 7;
int memo[MAX_N];


int init(int N, int X[], int Y[]) {
	long long max_profit = 0;
	long long num_horses = 1;
	for (int i=0; i<N; i++) {
		num_horses *= X[i];
		max_profit = max(max_profit, num_horses * Y[i]);
	}
	return max_profit;
}

int updateX(int pos, int val) {	
	return 0;
}

int updateY(int pos, int val) {
	return 0;
}

Compilation message

horses.cpp:7:15: error: array bound is not an integer constant before ']' token
    7 | int memo[MAX_N];
      |               ^
horses.cpp: In function 'int init(int, int*, int*)':
horses.cpp:17:9: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   17 |  return max_profit;
      |         ^~~~~~~~~~
horses.cpp: In function 'int updateX(int, int)':
horses.cpp:20:17: warning: unused parameter 'pos' [-Wunused-parameter]
   20 | int updateX(int pos, int val) {
      |             ~~~~^~~
horses.cpp:20:26: warning: unused parameter 'val' [-Wunused-parameter]
   20 | int updateX(int pos, int val) {
      |                      ~~~~^~~
horses.cpp: In function 'int updateY(int, int)':
horses.cpp:24:17: warning: unused parameter 'pos' [-Wunused-parameter]
   24 | int updateY(int pos, int val) {
      |             ~~~~^~~
horses.cpp:24:26: warning: unused parameter 'val' [-Wunused-parameter]
   24 | int updateY(int pos, int val) {
      |                      ~~~~^~~