Submission #43166

# Submission time Handle Problem Language Result Execution time Memory
43166 2018-03-09T17:07:54 Z yusufake Game (IOI13_game) C++
Compilation error
0 ms 0 KB
#include<bits/stdc++.h>
#include "game.h"
 
using namespace std;
 
#define _   int v, int tl, int tr
#define tm  (tl+tr >> 1)
#define sol l,tl,tm
#define sag r,tm+1,tr
 
#define mp make_pair
#define pb push_back
#define st first
#define nd second
 
typedef long long ll;
typedef pair < int , int > pp;
 
const int mod = 1e9 + 7;
const int N   = 22000 * 525;
 
int Y[N],L[N],R[N],posx,posy,lx,ly,rx,ry,id=1;
ll s[N],tt;
 
inline ll gcd(ll u, ll v) {
    ll r;
    while (v != 0) { r = u % v; u = v; v = r; }
    return u;
}

inline ll qry_y(_) { 
	if(ly > tr || ry < tl || !v) return 0;
	if (ly <= tl && tr <= ry) return s[v];
	return gcd(qry_y(sol) , qry_y(sag));
}
inline ll qry_x(_) { 
	if(lx > tr || rx < tl) return 0;
	if (lx <= tl && tr <= rx) return qry_y(Y[v], 0, mod);
	return gcd(qry_x(sol) , qry_x(sag));
}
 
void up_y(_, int r1, int r2){  // s[0] should contain ineffective element
	if(tl == tr){
		s[v] = r1 || r2 ? gcd(s[r1] , s[r2]) : tt;
		return;
	}
    int &l = L[v];
    int &r = R[v];
	if(posy > tm) { if(!r) r = ++id; up_y(r,tm+1,tr,R[r1],R[r2]); }
	else          { if(!l) l = ++id; up_y(l,tl,tm,L[r1],L[r2]); }
	s[v] = gcd(s[l] , s[r]);
}
void up_x(_){
    int &l = L[v];
    int &r = R[v];
	if(tl < tr){
		if(posx > tm) { if(!r) r = ++id; up_x(r,tm+1,tr); }
		else          { if(!l) l = ++id; up_x(l,tl,tm); }
	}
	if(!Y[v]) Y[v] = ++id;
	up_y(Y[v],0,mod,Y[l],Y[r]);
}
 
void update(int x, int y, ll t){
	posx = x;
	posy = y;
	tt = t;
	up_x(1,0,mod);
}	
ll calculate(int a, int b, int a2, int b2){
	lx = a; ly = b;
	rx = a2; ry = b2;
	return qry_x(1,0,mod);
}	
 
void init(int a, int b) {}

Compilation message

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 'll qry_y(int, int, int)':
game.cpp:8:13: error: 'l' was not declared in this scope
 #define sol l,tl,tm
             ^
game.cpp:34:19: note: in expansion of macro 'sol'
  return gcd(qry_y(sol) , qry_y(sag));
                   ^
game.cpp:7:16: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
 #define tm  (tl+tr >> 1)
                ^
game.cpp:8:18: note: in expansion of macro 'tm'
 #define sol l,tl,tm
                  ^
game.cpp:34:19: note: in expansion of macro 'sol'
  return gcd(qry_y(sol) , qry_y(sag));
                   ^
game.cpp:9:13: error: 'r' was not declared in this scope
 #define sag r,tm+1,tr
             ^
game.cpp:34:32: note: in expansion of macro 'sag'
  return gcd(qry_y(sol) , qry_y(sag));
                                ^
game.cpp:7:16: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
 #define tm  (tl+tr >> 1)
                ^
game.cpp:9:15: note: in expansion of macro 'tm'
 #define sag r,tm+1,tr
               ^
game.cpp:34:32: note: in expansion of macro 'sag'
  return gcd(qry_y(sol) , qry_y(sag));
                                ^
game.cpp: In function 'll qry_x(int, int, int)':
game.cpp:8:13: error: 'l' was not declared in this scope
 #define sol l,tl,tm
             ^
game.cpp:39:19: note: in expansion of macro 'sol'
  return gcd(qry_x(sol) , qry_x(sag));
                   ^
game.cpp:7:16: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
 #define tm  (tl+tr >> 1)
                ^
game.cpp:8:18: note: in expansion of macro 'tm'
 #define sol l,tl,tm
                  ^
game.cpp:39:19: note: in expansion of macro 'sol'
  return gcd(qry_x(sol) , qry_x(sag));
                   ^
game.cpp:9:13: error: 'r' was not declared in this scope
 #define sag r,tm+1,tr
             ^
game.cpp:39:32: note: in expansion of macro 'sag'
  return gcd(qry_x(sol) , qry_x(sag));
                                ^
game.cpp:7:16: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
 #define tm  (tl+tr >> 1)
                ^
game.cpp:9:15: note: in expansion of macro 'tm'
 #define sag r,tm+1,tr
               ^
game.cpp:39:32: note: in expansion of macro 'sag'
  return gcd(qry_x(sol) , qry_x(sag));
                                ^
game.cpp: In function 'void up_y(int, int, int, int, int)':
game.cpp:7:16: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
 #define tm  (tl+tr >> 1)
                ^
game.cpp:49:12: note: in expansion of macro 'tm'
  if(posy > tm) { if(!r) r = ++id; up_y(r,tm+1,tr,R[r1],R[r2]); }
            ^
game.cpp:7:16: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
 #define tm  (tl+tr >> 1)
                ^
game.cpp:49:42: note: in expansion of macro 'tm'
  if(posy > tm) { if(!r) r = ++id; up_y(r,tm+1,tr,R[r1],R[r2]); }
                                          ^
game.cpp:7:16: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
 #define tm  (tl+tr >> 1)
                ^
game.cpp:50:45: note: in expansion of macro 'tm'
  else          { if(!l) l = ++id; up_y(l,tl,tm,L[r1],L[r2]); }
                                             ^
game.cpp: In function 'void up_x(int, int, int)':
game.cpp:7:16: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
 #define tm  (tl+tr >> 1)
                ^
game.cpp:57:13: note: in expansion of macro 'tm'
   if(posx > tm) { if(!r) r = ++id; up_x(r,tm+1,tr); }
             ^
game.cpp:7:16: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
 #define tm  (tl+tr >> 1)
                ^
game.cpp:57:43: note: in expansion of macro 'tm'
   if(posx > tm) { if(!r) r = ++id; up_x(r,tm+1,tr); }
                                           ^
game.cpp:7:16: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
 #define tm  (tl+tr >> 1)
                ^
game.cpp:58:46: note: in expansion of macro 'tm'
   else          { if(!l) l = ++id; up_x(l,tl,tm); }
                                              ^