Submission #428277

#TimeUsernameProblemLanguageResultExecution timeMemory
428277haxormanHorses (IOI15_horses)C++14
Compilation error
0 ms0 KiB
#include "horses.h" #include "bits/stdc++.h" using namespace std; const int mxN = 5e5 + 7; const int MOD = 1e9 + 7; int n; long long x[mxN], y[mxN]; int init(int N, int X[], int Y[]) { n = N; for (int i = 0; i < n; ++i) { x[i] = X[i]; y[i] = Y[i]; } long long horses = 1 ans = 0; for (int i = 0; i < n; ++i) { horses *= x[i]; ans = max(ans, y[i] * horses); ans %= MOD; } return ans; } int updateX(int pos, int val) { x[pos] = val; long long horses = 1 ans = 0; for (int i = 0; i < n; ++i) { horses *= x[i]; ans = max(ans, y[i] * horses); ans %= MOD; } return ans; } int updateY(int pos, int val) { y[pos] = val; long long horses = 1 ans = 0; for (int i = 0; i < n; ++i) { horses *= x[i]; ans = max(ans, y[i] * horses); ans %= MOD; } return ans; }

Compilation message (stderr)

horses.cpp: In function 'int init(int, int*, int*)':
horses.cpp:18:23: error: expected ',' or ';' before 'ans'
   18 |  long long horses = 1 ans = 0;
      |                       ^~~
horses.cpp:21:3: error: 'ans' was not declared in this scope; did you mean 'abs'?
   21 |   ans = max(ans, y[i] * horses);
      |   ^~~
      |   abs
horses.cpp:24:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   24 |  return ans;
      |         ^~~
      |         abs
horses.cpp: In function 'int updateX(int, int)':
horses.cpp:29:23: error: expected ',' or ';' before 'ans'
   29 |  long long horses = 1 ans = 0;
      |                       ^~~
horses.cpp:32:3: error: 'ans' was not declared in this scope; did you mean 'abs'?
   32 |   ans = max(ans, y[i] * horses);
      |   ^~~
      |   abs
horses.cpp:35:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   35 |  return ans;
      |         ^~~
      |         abs
horses.cpp: In function 'int updateY(int, int)':
horses.cpp:40:23: error: expected ',' or ';' before 'ans'
   40 |  long long horses = 1 ans = 0;
      |                       ^~~
horses.cpp:43:3: error: 'ans' was not declared in this scope; did you mean 'abs'?
   43 |   ans = max(ans, y[i] * horses);
      |   ^~~
      |   abs
horses.cpp:46:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   46 |  return ans;
      |         ^~~
      |         abs