# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
897990 | UmairAhmadMirza | Game (IOI13_game) | C++17 | 0 ms | 0 KiB |
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>
using namespace std;
set<pair<int,int>> v;
long long grid[105][100005];
void init(int R, int C){
}
void update(int P, int Q, long long K){
v.insert({P,Q});
grid[P][Q]=K;
}
long long calculate(int P, int Q, int U, int V){
long long ans=0;
for (auto i:v)
{
int r=i.first;
int c=i.second;
if(P<=r&&r<=U&&Q<=c&&c<=V)
ans=__gcd(grid[r][c],ans);
}
return ans;
}