# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
375707 | vot808 | Game (IOI13_game) | C++17 | 13095 ms | 3552 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"
#ifdef mlocal
#include "grader.c"
#endif
using namespace std;
#define for_(i, s, e) for (int i = s; i < (int) e; i++)
#define for__(i, s, e) for (ll i = s; i < e; i++)
typedef long long ll;
typedef vector<int> vi;
typedef array<int, 2> ii;
#define endl '\n'
const int MXU = 22000;
ll updates[MXU][3];
int cu = 0;
map<ii, ll> mp;
void init(int R, int C) {
/* ... */
}
void update(int P, int Q, long long K) {
updates[cu][0] = P, updates[cu][1] = Q, updates[cu][2] = K;
cu++;
}
long long calculate(int P, int Q, int U, int V) {
mp.clear();
ll g = 0;
for_(i, 0, cu) if (updates[i][0] >= P and updates[i][1] >= Q and updates[i][0] <= U and updates[i][1] <= V) mp[{updates[i][0], updates[i][1]}] = updates[i][2];
for (auto &v: mp) {
if (g == 0) g = v.second;
else g = __gcd(g, v.second);
}
return g;
}
Compilation message (stderr)
# | 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... |