답안 #235932

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
235932 2020-05-30T11:56:09 Z crossing0ver 게임 (IOI13_game) C++17
0 / 100
6 ms 384 KB
#include<bits/stdc++.h>
#define ll long long 
#define tree int v,int tl,int tr
#define tm (tl + tr >> 1)
#define lhs L[v],tl,tm
#define rhs R[v], tm+1,tr
#include "game.h"

 
using namespace std;
const int N = 2E7;

int L[N],R[N],A[N],id,posx,posy, lx,ly,rx,ry;
ll ans[N],val;
ll get_y (tree) {
	if (tr < ly || tl > ry || !v) return 0;
	if (tl >= ly && tr <= ry) {
		return ans[v];
	}
	return __gcd ( get_y(lhs),get_y(rhs));	
	
}
ll get_x (tree) {
	if (tr < lx || tl > rx ) return 0;
	if (tl >= lx && tr <= rx) {
		if (!A[v]) return 0;
		return get_y(A[v],0,1e9);
	}
	return __gcd ( get_x (lhs), get_x(rhs));
}
void up_y(tree,int a,int b,bool flag) {
	if (tl == tr)	{
		if (flag) ans[v] = val;
		else ans[v] = __gcd(ans[a],ans[b]);
		return;
	}
	if (posy <= tm) {
		if (!L[v]) L[v] = ++id;
		up_y(lhs,L[a],L[b],flag);
	}
	else {
		if (!R[v]) R[v] = ++id;
		up_y(rhs,R[a],R[b],flag);
	}
	ans[v] = __gcd(ans[ L[v] ],ans[ R[v] ]);
}
void up_x(tree) {
	 if (tl < tr) {
	 	if (posx <= tm) {
	 		if (!L[v]) L[v] = ++id;
	 		up_x(lhs);
		 }
		 else {
		 	if (!R[v]) R[v] = ++id;
	 		up_x(rhs);
		 }
	 }
	 if (!A[v]) A[v] = ++id;
	 up_y(A[ v ],0,1e9,A[ L[v] ], A[ R[v] ],tl == tr); 
}
void update(int x, int y, ll t){
	posx = x;
	posy = y;
	val = t;
	up_x(1,0,1e9);
}
ll calculate(int a, int b, int a2, int b2){
	lx = a; ly = b;
	rx = a2; ry = b2;
	return get_x(1,0,1e9);
}	
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 'long long int get_y(int, int, int)':
game.cpp:4:16: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
 #define tm (tl + tr >> 1)
             ~~~^~~
game.cpp:5:21: note: in expansion of macro 'tm'
 #define lhs L[v],tl,tm
                     ^~
game.cpp:20:23: note: in expansion of macro 'lhs'
  return __gcd ( get_y(lhs),get_y(rhs)); 
                       ^~~
game.cpp:4:16: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
 #define tm (tl + tr >> 1)
             ~~~^~~
game.cpp:6:19: note: in expansion of macro 'tm'
 #define rhs R[v], tm+1,tr
                   ^~
game.cpp:20:34: note: in expansion of macro 'rhs'
  return __gcd ( get_y(lhs),get_y(rhs)); 
                                  ^~~
game.cpp: In function 'long long int get_x(int, int, int)':
game.cpp:4:16: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
 #define tm (tl + tr >> 1)
             ~~~^~~
game.cpp:5:21: note: in expansion of macro 'tm'
 #define lhs L[v],tl,tm
                     ^~
game.cpp:29:24: note: in expansion of macro 'lhs'
  return __gcd ( get_x (lhs), get_x(rhs));
                        ^~~
game.cpp:4:16: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
 #define tm (tl + tr >> 1)
             ~~~^~~
game.cpp:6:19: note: in expansion of macro 'tm'
 #define rhs R[v], tm+1,tr
                   ^~
game.cpp:29:36: note: in expansion of macro 'rhs'
  return __gcd ( get_x (lhs), get_x(rhs));
                                    ^~~
game.cpp: In function 'void up_y(int, int, int, int, int, bool)':
game.cpp:4:16: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
 #define tm (tl + tr >> 1)
             ~~~^~~
game.cpp:37:14: note: in expansion of macro 'tm'
  if (posy <= tm) {
              ^~
game.cpp:4:16: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
 #define tm (tl + tr >> 1)
             ~~~^~~
game.cpp:5:21: note: in expansion of macro 'tm'
 #define lhs L[v],tl,tm
                     ^~
game.cpp:39:8: note: in expansion of macro 'lhs'
   up_y(lhs,L[a],L[b],flag);
        ^~~
game.cpp:4:16: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
 #define tm (tl + tr >> 1)
             ~~~^~~
game.cpp:6:19: note: in expansion of macro 'tm'
 #define rhs R[v], tm+1,tr
                   ^~
game.cpp:43:8: note: in expansion of macro 'rhs'
   up_y(rhs,R[a],R[b],flag);
        ^~~
game.cpp: In function 'void up_x(int, int, int)':
game.cpp:4:16: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
 #define tm (tl + tr >> 1)
             ~~~^~~
game.cpp:49:16: note: in expansion of macro 'tm'
    if (posx <= tm) {
                ^~
game.cpp:4:16: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
 #define tm (tl + tr >> 1)
             ~~~^~~
game.cpp:5:21: note: in expansion of macro 'tm'
 #define lhs L[v],tl,tm
                     ^~
game.cpp:51:10: note: in expansion of macro 'lhs'
     up_x(lhs);
          ^~~
game.cpp:4:16: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
 #define tm (tl + tr >> 1)
             ~~~^~~
game.cpp:6:19: note: in expansion of macro 'tm'
 #define rhs R[v], tm+1,tr
                   ^~
game.cpp:55:10: note: in expansion of macro 'rhs'
     up_x(rhs);
          ^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Output is correct
2 Incorrect 6 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Output is correct
2 Incorrect 4 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Output is correct
2 Incorrect 6 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Output is correct
2 Incorrect 6 ms 256 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Output is correct
2 Incorrect 6 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -