Submission #334689

#TimeUsernameProblemLanguageResultExecution timeMemory
334689blue말 (IOI15_horses)C++17
Compilation error
0 ms0 KiB
#include "horses.h" using namespace std; int N; int* X; int* Y; int answer() { int product_X[N]; product_X[0] = X[0]; for(int i = 1; i < N; i++) product_X[i] = product_X[i-1] * X[i]; int y = 0; int res = 0; for(int i = N-1; i >= 0; i--) { y = max(y, Y[i]); res = max(res, product_X[i] * y); } return res; } int init(int n, int x[], int x[]) { N = n; X = x; Y = y; return answer(); } int updateX(int pos, int val) { X[pos] = val; return answer(); } int updateY(int pos, int val) { Y[pos] = val; return answer(); }

Compilation message (stderr)

horses.cpp: In function 'int answer()':
horses.cpp:18:13: error: 'max' was not declared in this scope
   18 |         y = max(y, Y[i]);
      |             ^~~
horses.cpp: At global scope:
horses.cpp:24:30: error: redefinition of 'int* x'
   24 | int init(int n, int x[], int x[])
      |                          ~~~~^~~
horses.cpp:24:21: note: 'int* x' previously declared here
   24 | int init(int n, int x[], int x[])
      |                 ~~~~^~~
horses.cpp: In function 'int init(int, int*)':
horses.cpp:28:9: error: 'y' was not declared in this scope
   28 |     Y = y;
      |         ^