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 <bits/stdc++.h>
#ifndef ARTHUR_LOCAL
#include "game.h"
#endif
using namespace std;
using ll=long long;
const int p2=262144;
ll st[10][p2+p2];
ll grid[100][100];
int r,c;
void init(int r_r, int c_r)
{
r=r_r;
c=c_r;
for(int i=0; i<100; i++)
{
for(int j=0; j<100; j++)
{
grid[i][j]=0;
}
}
for(int i=0; i<10; i++)
{
for(int j=0; j<p2+p2; j++)
{
st[i][j]=0;
}
}
}
void update(int p, int q, ll k)
{
q += p2;
st[p][q]=k;
q/=2;
while(q>0)
{
st[p][q] = __gcd(st[p][q+q],st[p][q+q+1]);
q/=2;
}
}
ll query(int p, int l, int r)
{
l+=p2;
r+=p2;
ll ans=0;
while(l<=r)
{
if(l%2 == 1) ans=__gcd(ans,st[p][l++]);
if(r%2 == 0) ans=__gcd(ans,st[p][r--]);
l/=2;
r/=2;
}
return ans;
}
ll calculate(int p, int q, int u, int v)
{
ll cur_gcd = 0;
for(int i=p; i<=u; i++)
{
cur_gcd = __gcd(cur_gcd,query(i,q,v));
}
#ifdef ARTHUR_LOCAL
cout << cur_gcd << endl;
#endif
return cur_gcd;
}
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... |