# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
384142 | 2021-03-31T14:26:25 Z | alishahali1382 | Game (IOI13_game) | C++14 | 0 ms | 0 KB |
#include "game.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; #define debug(x) {cerr<<#x<<"="<<x<<"\n";} #define debug2(x, y) {cerr<<#x<<", "<<#y<<" = "<<x<<", "<<y<<"\n";} #define debugp(p) {cerr<<#p" = {"<<p.first<<", "<<p.second<<"}\n";} #define pb push_back #define all(x) x.begin(), x.end() ll gcd2(ll X, ll Y) { ll tmp; while (X != Y && Y != 0) { tmp = X; X = Y; Y = tmp % Y; } return X; } const int SEGSZ=7000000, SEGSZ2=300000; ll A[100][100]; void init(int nn, int mm) { n=nn; m=mm; } void update(int P, int Q, ll K) { A[P][Q]=K; } ll calculate(int P, int Q, int U, int V) { ans=0; for (int i=P; i<=U; i++) for (int j=Q; j<=V; j++) ans=gcd2(ans, A[i][j]); return ans; }