Submission #251342

#TimeUsernameProblemLanguageResultExecution timeMemory
251342DavidDamianHorses (IOI15_horses)C++11
Compilation error
0 ms0 KiB
#include "horses.h" typedef long long ll; #define mod 1000000007 int Y[500005]; int X[500005]; ll product[500005]; int n; int init(int N, int y[], int x[]) { n=N; for(int i=0;i<n;i++){ X[i]=x[i]; Y[i]=y[i]; } ll maximum=0; product[0]=X[0]; maximum=X[0]*Y[0]; for(int i=1;i<n;i++){ product[i]=product[i-1]*X[i]; maximum=max(maximum,(ll)product[i]*(ll)Y[i]); } return maximum%mod; } int updateX(int pos, int val) { ll maximum=0; X[pos]=val; product[0]=X[0]; maximum=X[0]*Y[0]; for(int i=1;i<n;i++){ product[i]=product[i-1]*X[i]; maximum=max(maximum,(ll)product[i]*(ll)Y[i]); } return maximum%mod; } int updateY(int pos, int val) { ll maximum=0; Y[pos]=val; product[0]=X[0]; maximum=X[0]*Y[0]; for(int i=1;i<n;i++){ product[i]=product[i-1]*X[i]; maximum=max(maximum,(ll)product[i]*(ll)Y[i]); } }

Compilation message (stderr)

horses.cpp: In function 'int init(int, int*, int*)':
horses.cpp:19:17: error: 'max' was not declared in this scope
         maximum=max(maximum,(ll)product[i]*(ll)Y[i]);
                 ^~~
horses.cpp:21:16: warning: conversion to 'int' from 'll {aka long long int}' may alter its value [-Wconversion]
  return maximum%mod;
                ^
horses.cpp: In function 'int updateX(int, int)':
horses.cpp:31:17: error: 'max' was not declared in this scope
         maximum=max(maximum,(ll)product[i]*(ll)Y[i]);
                 ^~~
horses.cpp:33:16: warning: conversion to 'int' from 'll {aka long long int}' may alter its value [-Wconversion]
  return maximum%mod;
                ^
horses.cpp: In function 'int updateY(int, int)':
horses.cpp:43:17: error: 'max' was not declared in this scope
         maximum=max(maximum,(ll)product[i]*(ll)Y[i]);
                 ^~~
horses.cpp:45:1: warning: no return statement in function returning non-void [-Wreturn-type]
 }
 ^