#include <bits/stdc++.h>
using namespace std;
long long gcd(long long X, long long Y) {
long long tmp;
while (X != Y && Y != 0) {
tmp = X;
X = Y;
Y = tmp % Y;
}
return X;
}
long long a[102][102] = {{0}};
int main() {
long long R, C, Q;
cin >> R >> C >> Q;
while(Q--) {
long long command;
cin >> command;
if(command == 1) {
long long r, c, val;
cin >> r >> c >> val;
a[r][c] = val;
}
else {
long long ans = 0;
long long r1, c1, r2, c2;
cin >> r1 >> c1 >> r2 >> c2;
for(long long i = r1; i <= r2; i++) {
for(long long j = c1; j <= c2; j++) {
ans = gcd(ans, a[i][j]);
}
}
cout << ans << "\n";
}
}
}
Compilation message
grader.c: In function 'int main()':
grader.c:18:6: warning: variable 'res' set but not used [-Wunused-but-set-variable]
int res;
^~~
/tmp/ccobLsQq.o: In function `main':
game.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/cckd60Jo.o:grader.c:(.text.startup+0x0): first defined here
/tmp/cckd60Jo.o: In function `main':
grader.c:(.text.startup+0x5d): undefined reference to `init'
grader.c:(.text.startup+0xb8): undefined reference to `calculate'
grader.c:(.text.startup+0x122): undefined reference to `update'
collect2: error: ld returned 1 exit status