이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define all(x) x.begin(), x.end()
#define mp make_pair
#define mt make_tuple
#define x first
#define y second
#include "game.h"
ll gcd(ll x, ll y) {
ll tmp;
while (x != y && y != 0) {
tmp = x;
x = y;
y = tmp % y;
}
return x;
}
const int NN = 2020;
ll a[NN][NN];
vector<pair<int, int>> pa;
void init(int r, int c) {
(void)r; (void)c;
}
void update(int p, int q, ll k) {
pa.emplace_back(p, q);
a[p][q] = k;
}
ll calculate(int p, int q, int u, int v) {
ll ans = 0;
for (auto e : pa) {
if (p <= e.x && e.x <= u && q <= e.y && e.y <= v) {
ans = gcd(ans, a[e.x][e.y]);
}
}
return ans;
}
#ifdef LC
#include "grader.c"
#endif
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |