Submission #620817

#TimeUsernameProblemLanguageResultExecution timeMemory
620817A_DHorses (IOI15_horses)C++14
Compilation error
0 ms0 KiB
#include "horses.h" #include <bits/stdc++.h> using namespace std; const int N=1e3+100; long long x[N]; long long y[N]; const long long MOD=1e9+7; int init(int N, int X[], int Y[]){ long long ret=0; long long sum=1; for(int i=0;i<N;i++){ sum*=X[i]; if(sum*Y[i]>ret){ sum%=MOD; ret=sum*y[i]; } } return ret; } int updateX(int pos, int val) { x[pos]=val; long long ret=0; long long sum=1; for(int i=0;i<N;i++){ sum*=X[i]; if(sum*Y[i]>ret){ sum%=MOD; ret=sum*y[i]; } } return ret; } int updateY(int pos, int val) { y[pos]=val; long long ret=0; long long sum=1; for(int i=0;i<N;i++){ sum*=X[i]; if(sum*Y[i]>ret){ sum%=MOD; ret=sum*y[i]; } } return ret; }

Compilation message (stderr)

horses.cpp: In function 'int init(int, int*, int*)':
horses.cpp:11:14: warning: declaration of 'N' shadows a global declaration [-Wshadow]
   11 | int init(int N, int X[], int Y[]){
      |          ~~~~^
horses.cpp:7:11: note: shadowed declaration is here
    7 | const int N=1e3+100;
      |           ^
horses.cpp:23:12: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   23 |     return ret;
      |            ^~~
horses.cpp: In function 'int updateX(int, int)':
horses.cpp:35:14: error: 'X' was not declared in this scope
   35 |         sum*=X[i];
      |              ^
horses.cpp:36:16: error: 'Y' was not declared in this scope
   36 |         if(sum*Y[i]>ret){
      |                ^
horses.cpp:42:12: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   42 |     return ret;
      |            ^~~
horses.cpp: In function 'int updateY(int, int)':
horses.cpp:54:14: error: 'X' was not declared in this scope
   54 |         sum*=X[i];
      |              ^
horses.cpp:55:16: error: 'Y' was not declared in this scope
   55 |         if(sum*Y[i]>ret){
      |                ^
horses.cpp:61:12: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   61 |     return ret;
      |            ^~~