Submission #1004790

#TimeUsernameProblemLanguageResultExecution timeMemory
1004790magikarp23Horses (IOI15_horses)C++17
Compilation error
0 ms0 KiB
#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 (stderr)

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) {
      |                      ~~~~^~~