Submission #383975

#TimeUsernameProblemLanguageResultExecution timeMemory
383975ParsaAlizadehGame (IOI13_game)C++17
10 / 100
13067 ms2380 KiB
#include "game.h"
#include <bits/stdc++.h>
using namespace std;

typedef long long       ll;
typedef pair<ll, ll>    pll;
typedef pair<int, int>  pii;

#define all(x)          x.begin(), x.end()
#define kill(x)         return cout << x << endl, 0
#define X               first
#define Y               second
#define endl            '\n'

constexpr int N   = 2e3 + 10;

ll mp[N][N];

ll gcd2(ll x, ll y) {
    ll tmp;
    while (x != y && y != 0) {
        tmp = x;
        x = y;
        y = tmp % y;
    }
    return x;
}

void init(int R, int C) {
    assert(R < N && C < N);
}

void update(int P, int Q, long long K) {
    mp[P][Q] = K;
}

ll calculate(int P, int Q, int U, int V) {
    ll ans = 0;
    for (int i = P; i <= U; i++) {
        for (int j = Q; j <= V; j++) {
            ans = gcd2(ans, mp[i][j]);
        }
    }
    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...