Submission #798785

#TimeUsernameProblemLanguageResultExecution timeMemory
798785vjudge1Game (IOI13_game)C++17
Compilation error
0 ms0 KiB
#include "game.h" #include <bits/stdc++.h> using namespace std; int m, n, q, x, y, u, v, val, tt; struct node1 { int l, r, ss; node1 *left, *right; node1(int _l, int _r) { l = _l; r = _r; ss = 0; left = right = NULL; } void down() { if (l != r && left == NULL) { int mid=(l+r)>>1; left = new node1(l, mid); right = new node1(mid+1, r); } } void update(int i, int v) { if (r < i || i < l) return; down(); if (l == r) { ss = v; return; } left->update(i, v); right->update(i, v); ss = __gcd(left->ss, right->ss); } int get(int a, int b) { if (r < a || b < l) return 0; down(); if (a <= l && r <= b) return ss; return __gcd(left->get(a, b), right->get(a, b)); } }; struct node2 { int l, r, ss; node2 *left, *right; node1 *node; node2(int _l, int _r) { l = _l; r = _r; ss = 0; left = right = NULL; node = new node1(1, n); } void down() { if (l!=r && left == NULL) { int mid=(l+r)>>1; left = new node2(l, mid); right = new node2(mid+1, r); } } void update(int x, int y, int val) { if (r<x || x<l) return; down(); node->update(y, val); if (l==r) return; left->update(x, y, val); right->update(x, y, val); } int get(int x, int y, int u, int v) { if (r<x || u<l) return 0; down(); if (x<=l && r<=u) return node->get(y, v); return __gcd(left->get(x, y, u, v), right->get(x, y, u, v)); } }; node2* root; void init(int R, int C) { m=R; n=C; root = new node2(1, R); } void update(int P, int Q, int K) { return root->update(P+1, Q+1, K); } int calculate(int P, int Q, int U, int V) { return root->get(P+1, Q+1, U+1, V+1); }

Compilation message (stderr)

game.cpp:101:5: error: ambiguating new declaration of 'int calculate(int, int, int, int)'
  101 | int calculate(int P, int Q, int U, int V)
      |     ^~~~~~~~~
In file included from game.cpp:1:
game.h:10:11: note: old declaration 'long long int calculate(int, int, int, int)'
   10 | long long calculate(int P, int Q, int U, int V);
      |           ^~~~~~~~~