Submission #672337

#TimeUsernameProblemLanguageResultExecution timeMemory
672337Trisanu_DasHorses (IOI15_horses)C++17
Compilation error
0 ms0 KiB
#include "horses.h" #include <bits/stdc++.h> #define mod 1000000007 using namespace std; typedef long long ll; int n; int node{ ll v, x, y; double dx, dy, dv; }t[4 * 500005]; node merge(node a, node b){ node res; b.dx += a.dx, b.dv += a.dx; if (a.dv > b.dv) res.v = a.v, res.dv = a.dv; else res.v = a.x * b.v % mod, res.dv = b.dv; res.x = a.x * b.x % mod; res.dx = b.dx; return res; } node upd(int i, int l, int r, int ps, ll vx, ll vy){ if (l > ps || r < ps) return t[x]; if (l == r && l == ps) { node& nd = t[x]; if (vx) nd.dx = log(vx), nd.x = vx; if (vy) nd.dy = log(vy), nd.y = vy; nd.v = nd.x * nd.y % mod, nd.dv = nd.dx + nd.dy; return nd; } int m = (l + r) / 2; return t[i] = merge(update(i * 2, l, mid, ps, vx, vy), update(i * 2 + 1, mid + 1, r, ps, vx, vy)); } int init(int N, int X[], int Y[]) { n = N; for (int i = 0; i < N; i++) update(1, 0, n - 1, i, X[i], Y[i]); return t[1].v; } int updateX(int pos, int val) { update(1, 0, n - 1, pos, val, 0); return t[1].v; } int updateY(int pos, int val) { update(1, 0, n - 1, pos, 0, val); return t[1].v; }

Compilation message (stderr)

horses.cpp:10:6: error: expected primary-expression before 'v'
   10 |   ll v, x, y; double dx, dy, dv;
      |      ^
horses.cpp:10:6: error: expected '}' before 'v'
horses.cpp:9:9: note: to match this '{'
    9 | int node{
      |         ^
horses.cpp:11:1: error: expected declaration before '}' token
   11 | }t[4 * 500005];
      | ^
horses.cpp:11:2: error: 't' does not name a type
   11 | }t[4 * 500005];
      |  ^
horses.cpp:13:1: error: 'node' does not name a type
   13 | node merge(node a, node b){
      | ^~~~
horses.cpp:24:1: error: 'node' does not name a type
   24 | node upd(int i, int l, int r, int ps, ll vx, ll vy){
      | ^~~~
horses.cpp: In function 'int init(int, int*, int*)':
horses.cpp:39:30: error: 'update' was not declared in this scope; did you mean 'updateY'?
   39 |  for (int i = 0; i < N; i++) update(1, 0, n - 1, i, X[i], Y[i]);
      |                              ^~~~~~
      |                              updateY
horses.cpp:40:9: error: 't' was not declared in this scope
   40 |  return t[1].v;
      |         ^
horses.cpp: In function 'int updateX(int, int)':
horses.cpp:44:2: error: 'update' was not declared in this scope; did you mean 'updateY'?
   44 |  update(1, 0, n - 1, pos, val, 0);
      |  ^~~~~~
      |  updateY
horses.cpp:45:9: error: 't' was not declared in this scope
   45 |  return t[1].v;
      |         ^
horses.cpp: In function 'int updateY(int, int)':
horses.cpp:49:2: error: 'update' was not declared in this scope; did you mean 'updateY'?
   49 |  update(1, 0, n - 1, pos, 0, val);
      |  ^~~~~~
      |  updateY
horses.cpp:50:9: error: 't' was not declared in this scope
   50 |  return t[1].v;
      |         ^