# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
962855 | simona1230 | 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>
#include "game.h"
using namespace std;
int r,c;
int a[128][128];
void init(int R,int C)
{
r=R;
c=C;
}
void update(int x,int y,int v)
{
a[x][y]=v;
}
int calculate(int p,int q,int u,int v)
{
int ans=-1;
for(int i=p;i<=u;i++)
{
for(int j=q;j<=v;j++)
{
if(a[i][j]!=0)
{
if(ans==-1)ans=a[i][j];
else ans=__gcd(ans,a[i][j]);
}
}
}
return ans;
}