# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1090441 | vjudge1 | 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;
long long nzd(long long a, long long b) {
if (b==0) return a;
return nzd(b, a%b);
}
vector<vector<long long> > mat;
void init(int r, int c) {
mat.resize(r, vector<long long> (c, 0));
}
void update(int r, int c, long long br) {
mat[r][c]=br;
}
long long calculate(int x1, int y1, int x2, int y2) {
long long rez=mat[x1][y1];
for (int i=x1;i<=x2;i++)
for (int j=y1;j<=y2;j++)
rez=nzd(rez, mat[i][j]);
return rez;
}