# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
897943 | Muhammad_Aneeq | 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 <numeric>
#include <map>
#include <algorithm>
using namespace std;
int r,c;
int const N=2000;
map<pair<int,int>,long long>d;
void init(int R, int C)
{
r=R;
c=C;
}
void update(int P, int Q, long long K)
{
d[{P,Q}]=K;
}
long long calculate(int P, int Q, int U, int V)
{
long long ans=0;
for (auto i:d)
{
int x,y;
tie(x,y)=i.first;
if (x>=P&&x<=U&&y>=Q&&y<=V)
ans=gcd(ans,i.second);
}
return ans;
}