This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "game.h"
#include <cstring>
#include <algorithm>
long long **mat;
long long ****rmq;
long long **aintX, **aintY, val, ans;
int nrlin, nrcol, r, c, lg2[100001], left, right, poz;
long long gcd2(long long X, long long Y) {
long long tmp;
while (X != Y && Y != 0) {
tmp = X;
X = Y;
Y = tmp % Y;
}
return X;
}
void query(long long aint[], int p, int st, int dr) {
if (left <= st && dr <= right)
ans = gcd2(aint[p], ans);
else {
int m = (st + dr) / 2;
if (left <= m) query(aint, 2 * p, st, m);
if (m < right) query(aint, 2 * p + 1, m + 1, dr);
}
}
void update(long long aint[], int p, int st, int dr) {
if (st == dr)
aint[p] = val;
else {
int m = (st + dr) / 2;
if (poz <= m) update(aint, 2 * p, st, m);
else update(aint, 2 * p + 1, m + 1, dr);
aint[p] = gcd2(aint[2 * p], aint[2 * p + 1]);
}
}
void init(int R, int C) {
r = R;
c = C;
mat = new long long*[R];
for (int i = 0; i < R; i++) {
mat[i] = new long long[C];
for (int j = 0; j < C; j++)
mat[i][j] = 0;
}
aintX = new long long*[R];
for (int i = 0; i < R; i++) {
aintX[i] = new long long[4 * C];
for (int j = 0; j < 4 * C; j++)
aintX[i][j] = 0;
}
}
void update(int P, int Q, long long K) {
poz = Q;
val = K;
update(aintX[P], 1, 0, c - 1);
}
long long calculate(int P, int Q, int U, int V) {
ans = 0;
left = Q;
right = V;
for (int i = P; i <= U; i++)
query(aintX[i], 1, 0, c - 1);
return ans;
}
Compilation message (stderr)
grader.c: In function 'int main()':
grader.c:18:6: warning: variable 'res' set but not used [-Wunused-but-set-variable]
int res;
^~~
# | 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... |