이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#define ll long long
#include "game.h"
using namespace std;
int r1,c1;
ll gcd2(ll X, ll Y) {
long long tmp;
while (X != Y && Y != 0) {
tmp = X;
X = Y;
Y = tmp % Y;
}
return X;
}
ll t[2*2060][2*2060];
void init(int R, int C) {
r1 = R;c1 = C;
/* ... */
}
ll val;
void upd_y(int vx,int lx,int rx,int vy,int ly,int ry,int x,int y) {
if (ly == ry) {
if (lx == rx) t[vx][vy] = val;
else t[vx][vy] = gcd2(t[vx*2][vy],t[vx*2+1][vy]);
}else {
int tm = (ly + ry)/2;
if (y <= tm)
upd_y(vx,lx,rx,vy*2,ly,tm,x,y);
else
upd_y(vx,lx,rx,vy*2+1,tm,ry,x,y);
t[vx][vy] = gcd2(t[vx][vy*2],t[vx][vy*2+1]);
}
}
void upd_x(int vx,int lx,int rx,int x,int y) {
if (lx != rx) {
int tm = (lx + rx)/2;
if (x <= tm)
upd_x(vx*2,lx,tm,x,y);
else upd_x(vx*2+1,tm+1,rx,x,y);
}
upd_y(vx,lx,rx,1,0,c1-1,x,y);
}
int LX,LY,RX,RY;
ll get_y(int vx,int lx,int rx,int vy,int ly,int ry) {
if (LY > ry || RY < ly) return 0;
if (ly == ry) {
if (lx == rx) return t[vx][vy];
else return gcd2(t[vx*2][vy],t[vx*2+1][vy]);
}else {
int tm = (ly + ry)/2;
// if (y <= tm)
// return 0;
return gcd2(get_y(vx,lx,rx,vy*2,ly,tm),get_y(vx,lx,rx,vy*2+1,tm,ry));
//t[vx][vy] = gcd2(t[vx][vy*2],t[vx][vy*2+1]);
}
}
ll get_x(int vx,int lx,int rx) {
if (LX > rx || RX < lx) return 0;
if (lx != rx) {
int tm = (lx + rx)/2;
return gcd2(get_x(vx*2,lx,tm),get_x(vx*2+1,tm+1,rx));
}else return get_y(vx,lx,rx,1,0,c1-1);
// upd_y(vx,lx,rx,vy,ly,ry,x,y);
}
void update(int P, int Q, long long K) {
val = K;
upd_x(1,0,r1-1,P,Q);
/* ... */
}
long long calculate(int P, int Q, int U, int V) {
LX = P; LY = Q;
RX = U; RY = V;
return get_x(1,0,r1-1);
/* ... */
return 42;
}
컴파일 시 표준 에러 (stderr) 메시지
grader.c: In function 'int main()':
grader.c:25:5: warning: this 'while' clause does not guard... [-Wmisleading-indentation]
25 | while(res != 1);
| ^~~~~
grader.c:26:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'while'
26 | res = fscanf(f, "%d", &C);
| ^~~
grader.c:27:5: warning: this 'while' clause does not guard... [-Wmisleading-indentation]
27 | while(res != 1);
| ^~~~~
grader.c:28:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'while'
28 | res = fscanf(f, "%d", &N);
| ^~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |