Submission #65065

#TimeUsernameProblemLanguageResultExecution timeMemory
65065theknife2001Game (IOI13_game)C++17
37 / 100
13087 ms132436 KiB
#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=1e5+55; long long tree[N*4][105]; int n,m; void init(int R, int C) { n=R; m=C; } void up(int l , int r , int node , int ind , long long val , int lev) { if(l==r&&l==ind) { tree[node][lev]=val; return ; } if(ind<=mid) up(l,mid,node*2,ind,val,lev); else up(mid+1,r,node*2+1,ind,val,lev); tree[node][lev]=gcd2(tree[node*2][lev],tree[node*2+1][lev]); } long long query(int l , int r , int node , int x , int y , int lev) { if(x<=l&&r<=y) return tree[node][lev]; if(l>y||r<x) return 0; long long temp1=0; long long temp2=0; temp1=query(l,mid,node*2,x,y,lev); temp2=query(mid+1,r,node*2+1,x,y,lev); return gcd2(temp1,temp2); } void update(int P, int Q, long long K) { up(0,m-1,1,Q,K,P); } long long calculate(int P, int Q, int U, int V) { if(P>U) swap(P,U); if(Q>V) swap(Q,V); long long ans=0; for(int i=P;i<=U;i++) { ans=gcd2(ans,query(0,m-1,1,Q,V,i)); } 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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...