Submission #237812

#TimeUsernameProblemLanguageResultExecution timeMemory
237812mohamedsobhi777Game (IOI13_game)C++14
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> #include "game.h" using namespace std ; const int N =10000 + 7 ; int n; long long gcd2(long long X, long long Y) { long long tmp; while (X != Y && Y != 0) { tmp = X; X = Y; Y = tmp % Y; } return X; } struct dynamic_segmentree{ int count ; int iden = 0 ; vector<int> tree , lc , rc ; void init(int _n){ count = 0 ; tree.resize(4*_n) ; lc = vector<int> (4*_n , -1) ; rc = vector<int> (4*_n , -1) ; } int f(int x , int y){ return gcd2(x , y) ; } void update(int node , int L , int R , int ix , int val){ if(L == R){ tree[node] = val ; return ; } int mid = (L+R) >>1 ; if(ix<=mid){ if(lc[node] == -1) lc[node] = ++count ; update(lc[node] , L , mid , ix , val) ; } else{ if(rc[node] == -1) rc[node] = ++count ; update(rc[node] , mid+1 , R , ix , val) ; } if(lc[node] == -1) tree[node] = tree[rc[node]] ; else if(rc[node] == -1) tree[node] = tree[lc[node]] ; else tree[node] = f(tree[lc[node]] , tree[rc[node]]) ; } int query(int node , int L , int R , int l , int r){ if(l > R || r < L || node == -1) return iden ; if(L>=l && R<=r) return tree[node] ; int mid = (L+R) >>1 ; int s1 = query(lc[node] , L , mid , l , r) ; int s2 = query(rc[node] , mid+1 , R , l , r) ; return f(s1 , s2) ; } } ; vector<dynamic_segmentree> d ; void update(int a , int b , int c){ b++ ; d[a].update(0 , 1 , N , b ,c ) ; } int calculate(int a , int b , int c , int e){ int ret = 0 ; b++ ; e++ ; for(int i = a ; i<=c ;i++){ ret = gcd2(ret , d[i].query(0 , 1, N , b , e)) ; } return ret ; } void init(int R, int C) { d.resize(R+2) ; for(int i = 0 ;i <=R ; i++){ d[i].init(C+1) ; } }

Compilation message (stderr)

grader.c: In function 'int main()':
grader.c:18:6: warning: variable 'res' set but not used [-Wunused-but-set-variable]
  int res;
      ^~~
game.cpp: In function 'int calculate(int, int, int, int)':
game.cpp:82:5: error: ambiguating new declaration of 'int calculate(int, int, int, int)'
 int calculate(int a , int b , int c , int e){
     ^~~~~~~~~
In file included from game.cpp:2:0:
game.h:10:11: note: old declaration 'long long int calculate(int, int, int, int)'
 long long calculate(int P, int Q, int U, int V);
           ^~~~~~~~~