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 "game.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pii pair<int, int>
#define ff first
#define ss second
#define pb push_back
ll gcd(ll a, ll b) {
while (b) b ^= a ^= b ^= a %= b;
return a;
}
void init(int R, int C) {
}
vector<pair<pii, ll>> v;
void update(int P, int Q, long long K) {
v.pb({{P, Q}, K});
}
long long calculate(int P, int Q, int U, int V) {
if (P > U) swap(P, U);
if (V > Q) swap(V, Q);
ll res = 0;
for (pair<pii, ll> &x : v) {
if (P <= x.ff.ff && x.ff.ff <= U && Q <= x.ff.ss && x.ff.ss <= V) {
res = gcd(res, x.ss);
}
}
return res;
}
# | 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... |