Submission #1315490

#TimeUsernameProblemLanguageResultExecution timeMemory
1315490kawhietGame (IOI13_game)C++20
10 / 100
13090 ms5132 KiB
#include <bits/stdc++.h>
#include "game.h"
using namespace std;

int n, m;
vector<array<long long, 3>> pos;

void init(int R, int C) {
    n = R;
    m = C;
}

void update(int i, int j, long long k) {
    for (auto &[x, y, s] : pos) {
        if (x == i && y == j) {
            s = k;
            return;
        }
    }
    pos.push_back({i, j, k});
}

long long calculate(int p, int q, int u, int v) {
    long long ans = 0;
    for (auto [i, j, x] : pos) {
        if (p <= i && i <= u && q <= j && j <= v) {
            ans = gcd(ans, x);
        }
    }
    return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...