# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
146118 | youssefbou62 | Game (IOI13_game) | C++14 | 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;
using ll = long long ;
const int N = 105 ;
ll Mat[N][N] ;
long long gcd2(long long X, long long Y) {
long long tmp;
while (X != Y && Y != 0) {
tmp = X;
X = Y;
Y = tmp % Y;
}
return X;
}
void init(int R, int C) {
/* ... */
}
void update(int P, int Q, long long K) {
/* ... */
Mat[P][Q]=K;
}
long long calculate(int P, int Q, int U, int V) {
/* ... */
ll ans = 0 ;
for(int i = P ; <= U ; i++ ){
for(int j = Q;j<=V;j++ )ans = gcd2(ans,Mat[i][j]);
}
return ans;
}