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>
#ifndef EVAL
#include"grader.c"
#endif
using namespace std;
struct jfkdjflsfjldks{
long long tree[8000];
void build(){
for(int i=0;i<8000;i++)tree[i]=0;
}
long long get(int v,int l,int r,int ql,int qr){
if(qr<l||r<ql)return 0ll;
if(ql<=l&&r<=qr)return tree[v];
int mid=(l+r)>>1;
return __gcd(get(v<<1,l,mid,ql,qr),get(v<<1|1,mid+1,r,ql,qr));
}
void update(int v,int l,int r,int pos,long long val){
if(l==r){
tree[v]=val;
return;
}
int mid=(l+r)>>1;
if(pos<=mid)update(v<<1,l,mid,pos,val);
else update(v<<1|1,mid+1,r,pos,val);
tree[v]=__gcd(tree[v<<1],tree[v<<1|1]);
}
}tree[2000];
void init(int R,int C){
for(int i=0;i<2000;i++)tree[i].build();
}
void update(int P,int Q,long long K){
tree[P].update(1,0,1999,Q,K);
}
long long calculate(int P,int Q,int U,int V){
long long res=0;
for(int i=P;i<=U;i++)
res=__gcd(res,tree[i].get(1,0,1999,Q,V));
return 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... |