제출 #962882

#제출 시각아이디문제언어결과실행 시간메모리
962882n3rm1n게임 (IOI13_game)C++17
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h> #include "game.h" using namespace std; long long r, c; void init(long long R, long long C) { r = R; c = C; } long long t[105][400005]; long long line, ql, qr; long long query(long long i, long long l, long long r) { if(ql > r || qr < l)return 0; if(ql < l && r <= qr)return t[line][i]; long long mid = (l + r)/2; return gcd2(query(2*i, l, mid), query(2*i+1, mid+1, r)); } long long pnt; long long val; void upd(long long i, long long l, long long r) { if(l == r) { t[line][i] = val; return; } long long mid = (l + r)/2; if(pnt <= mid)upd(2*i, l, mid); else upd(2*i+1, mid+1, r); t[line][i] = gcd2(t[line][2*i], t[line][2*i+1]); } void update(long long P, long long Q, long long K) { P ++; Q ++; line = P; pnt = Q; val = K; update(1, 1, c); } long long calculate(long long P, long long Q, long long U, long long V) { P ++; Q ++; U ++; V ++; long long ans = 0; ql = Q; qr = V; for (line = P; line <= U; ++ line) ans = gcd2(ans, query(1, 1, c)); return ans; }

컴파일 시 표준 에러 (stderr) 메시지

game.cpp: In function 'long long int query(long long int, long long int, long long int)':
game.cpp:18:12: error: 'gcd2' was not declared in this scope
   18 |     return gcd2(query(2*i, l, mid), query(2*i+1, mid+1, r));
      |            ^~~~
game.cpp: In function 'void upd(long long int, long long int, long long int)':
game.cpp:32:18: error: 'gcd2' was not declared in this scope
   32 |     t[line][i] = gcd2(t[line][2*i], t[line][2*i+1]);
      |                  ^~~~
game.cpp: In function 'long long int calculate(long long int, long long int, long long int, long long int)':
game.cpp:54:15: error: 'gcd2' was not declared in this scope
   54 |         ans = gcd2(ans, query(1, 1, c));
      |               ^~~~