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 <bits/stdc++.h>
#define mid (l+r)/2
using namespace std;
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;
}
const int N=2055;
long long sp[N][N][11];
int n,m;
void init(int R, int C)
{
n=R;
m=C;
}
void update(int P, int Q, long long K)
{
sp[P][Q][0]=K;
for(int i=1;i<=10;i++)
{
for(int j=0;j<m;j++)
{
sp[P][j][i]=gcd2(sp[P][j+(1<<(i-1))][i-1],sp[P][j][i-1]);
}
}
}
long long calculate(int P, int Q, int U, int V)
{
long long ans=0;
int l=0;
for(int i=10;i>=0;i--)
{
if((V-Q)&(1<<i))
{
l=i;
break;
}
}
for(int i=P;i<=U;i++)
{
ans=gcd2(sp[i][Q][l],sp[i][V-(1<<l)][l]);
}
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... |