답안 #135135

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
135135 2019-07-23T16:37:57 Z Nucleist 게임 (IOI13_game) C++14
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h> 
#include "game.h"
using namespace std; 
int mx,m;
int x,y;
int tlx,trx,tly,tryi;
long long a[2001][2001]={0};
long long t[2001*4][2001*4]={0};
void init(int R,int C)
{
   for (int i = 0; i < R; ++i)
   {
   	for (int j = 0; j < C; ++j)
   	{
   		a[i][j]=0;
   	}
   }
   for (int i = 0; i < R*4; ++i)
   {
   	for (int j = 0; j < C*4; ++j)
   	{
   		a[i][j]=0;
   	}
   }
}
void build_y(int vx, int lx, int rx, int vy, int ly, int ry) {
    if (ly == ry) {
        if (lx == rx)
            t[vx][vy] = a[lx][ly];
        else
            t[vx][vy] = gcd2(t[vx*2][vy],t[vx*2+1][vy]);
    } else {
        int my = (ly + ry) / 2;
        build_y(vx, lx, rx, vy*2, ly, my);
        build_y(vx, lx, rx, vy*2+1, my+1, ry);
        t[vx][vy] = gcd2(t[vx][vy*2],t[vx][vy*2+1]);
    }
}

void build_x(int vx, int lx, int rx) {
    if (lx != rx) {
        int mx = (lx + rx) / 2;
        build_x(vx*2, lx, mx);
        build_x(vx*2+1, mx+1, rx);
    }
    build_y(vx, lx, rx, 1, 0, m-1);
}
long long sum_y(int vx, int vy, int tly, int try_, int ly, int ry) {
    if (ly > ry) 
        return 0;
    if (ly == tly && try_ == ry)
        return t[vx][vy];
    int tmy = (tly + try_) / 2;
    return gcd2(sum_y(vx, vy*2, tly, tmy, ly, min(ry, tmy))
         ,sum_y(vx, vy*2+1, tmy+1, try_, max(ly, tmy+1), ry));
}

long long sum_x(int vx, int tlx, int trx, int lx, int rx, int ly, int ry) {
    if (lx > rx)
        return 0;
    if (lx == tlx && trx == rx)
        return sum_y(vx, 1, 0, m-1, ly, ry);
    int tmx = (tlx + trx) / 2;
    return gcd2(sum_x(vx*2, tlx, tmx, lx, min(rx, tmx), ly, ry)
         , sum_x(vx*2+1, tmx+1, trx, max(lx, tmx+1), rx, ly, ry));
}
void update_y(int vx, int lx, int rx, int vy, int ly, int ry, int x, int y, long long new_val) {
    if (ly == ry) {
        if (lx == rx)
            t[vx][vy] = new_val;
        else
            t[vx][vy] = gcd2(t[vx*2][vy] , t[vx*2+1][vy]);
    } else {
        int my = (ly + ry) / 2;
        if (y <= my)
            update_y(vx, lx, rx, vy*2, ly, my, x, y, new_val);
        else
            update_y(vx, lx, rx, vy*2+1, my+1, ry, x, y, new_val);
        t[vx][vy] = gcd2(t[vx][vy*2] , t[vx][vy*2+1]);
    }
}

void update_x(int vx, int lx, int rx, int x, int y, long long new_val) {
    if (lx != rx) {
        int mx = (lx + rx) / 2;
        if (x <= mx)
            update_x(vx*2, lx, mx, x, y, new_val);
        else
            update_x(vx*2+1, mx+1, rx, x, y, new_val);
    }
    update_y(vx, lx, rx, 1, 0, m-1, x, y, new_val);
}
void update(int P,int Q,long long value)
{
	update_x(1,0,x-1,P,Q,value);
}
long long calculate(int P,int Q,int U,int V)
{
	return sum_x(1,0,x-1,P,U,Q,V);
}


//code the AC sol !
// BS/queue/map

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 'void build_y(int, int, int, int, int, int)':
game.cpp:31:25: error: 'gcd2' was not declared in this scope
             t[vx][vy] = gcd2(t[vx*2][vy],t[vx*2+1][vy]);
                         ^~~~
game.cpp:31:25: note: suggested alternative: 'gcvt'
             t[vx][vy] = gcd2(t[vx*2][vy],t[vx*2+1][vy]);
                         ^~~~
                         gcvt
game.cpp:36:21: error: 'gcd2' was not declared in this scope
         t[vx][vy] = gcd2(t[vx][vy*2],t[vx][vy*2+1]);
                     ^~~~
game.cpp:36:21: note: suggested alternative: 'gcvt'
         t[vx][vy] = gcd2(t[vx][vy*2],t[vx][vy*2+1]);
                     ^~~~
                     gcvt
game.cpp: In function 'long long int sum_y(int, int, int, int, int, int)':
game.cpp:54:12: error: 'gcd2' was not declared in this scope
     return gcd2(sum_y(vx, vy*2, tly, tmy, ly, min(ry, tmy))
            ^~~~
game.cpp:54:12: note: suggested alternative: 'gcvt'
     return gcd2(sum_y(vx, vy*2, tly, tmy, ly, min(ry, tmy))
            ^~~~
            gcvt
game.cpp: In function 'long long int sum_x(int, int, int, int, int, int, int)':
game.cpp:64:12: error: 'gcd2' was not declared in this scope
     return gcd2(sum_x(vx*2, tlx, tmx, lx, min(rx, tmx), ly, ry)
            ^~~~
game.cpp:64:12: note: suggested alternative: 'gcvt'
     return gcd2(sum_x(vx*2, tlx, tmx, lx, min(rx, tmx), ly, ry)
            ^~~~
            gcvt
game.cpp: In function 'void update_y(int, int, int, int, int, int, int, int, long long int)':
game.cpp:72:25: error: 'gcd2' was not declared in this scope
             t[vx][vy] = gcd2(t[vx*2][vy] , t[vx*2+1][vy]);
                         ^~~~
game.cpp:72:25: note: suggested alternative: 'gcvt'
             t[vx][vy] = gcd2(t[vx*2][vy] , t[vx*2+1][vy]);
                         ^~~~
                         gcvt
game.cpp:79:21: error: 'gcd2' was not declared in this scope
         t[vx][vy] = gcd2(t[vx][vy*2] , t[vx][vy*2+1]);
                     ^~~~
game.cpp:79:21: note: suggested alternative: 'gcvt'
         t[vx][vy] = gcd2(t[vx][vy*2] , t[vx][vy*2+1]);
                     ^~~~
                     gcvt