Submission #251578

#TimeUsernameProblemLanguageResultExecution timeMemory
251578DavidDamianHorses (IOI15_horses)C++11
Compilation error
0 ms0 KiB
#include "horses.h" #include<bits/stdc++.h> using namespace std; #define mod 100000007 typedef long long ll; int x[100005]; int y[100005]; int init(int N, int X[], int Y[]) { for(int i=0;i<n;i++){ x[i]=X[i]; y[i]=Y[i]; } ll maximum=0; ll product=1; for(int i=0;i<N;i++){ product*=X[i]; maximum=max(maximum,Y[i]*product); } return maximum; } int updateX(int pos, int val) { x[pos]=val; ll maximum=0; ll product=1; for(int i=0;i<N;i++){ product*=X[i]; maximum=max(maximum,Y[i]*product); } return maximum; } int updateY(int pos, int val) { y[pos]=val; ll maximum=0; ll product=1; for(int i=0;i<N;i++){ product*=X[i]; maximum=max(maximum,Y[i]*product); } return maximum; }

Compilation message (stderr)

horses.cpp: In function 'int init(int, int*, int*)':
horses.cpp:9:16: error: 'n' was not declared in this scope
  for(int i=0;i<n;i++){
                ^
horses.cpp:19:9: warning: conversion to 'int' from 'll {aka long long int}' may alter its value [-Wconversion]
  return maximum;
         ^~~~~~~
horses.cpp: In function 'int updateX(int, int)':
horses.cpp:26:16: error: 'N' was not declared in this scope
  for(int i=0;i<N;i++){
                ^
horses.cpp:27:18: error: 'X' was not declared in this scope
         product*=X[i];
                  ^
horses.cpp:28:29: error: 'Y' was not declared in this scope
         maximum=max(maximum,Y[i]*product);
                             ^
horses.cpp:30:9: warning: conversion to 'int' from 'll {aka long long int}' may alter its value [-Wconversion]
  return maximum;
         ^~~~~~~
horses.cpp: In function 'int updateY(int, int)':
horses.cpp:37:16: error: 'N' was not declared in this scope
  for(int i=0;i<N;i++){
                ^
horses.cpp:38:18: error: 'X' was not declared in this scope
         product*=X[i];
                  ^
horses.cpp:39:29: error: 'Y' was not declared in this scope
         maximum=max(maximum,Y[i]*product);
                             ^
horses.cpp:41:9: warning: conversion to 'int' from 'll {aka long long int}' may alter its value [-Wconversion]
  return maximum;
         ^~~~~~~