제출 #765247

#제출 시각아이디문제언어결과실행 시간메모리
765247fatemetmhr게임 (IOI13_game)C++17
10 / 100
13084 ms2696 KiB
//  ~ Be Name Khoda ~  //

#include "game.h"
#include <bits/stdc++.h>
//#pragma GCC optimize ("O3")
//#pragma GCC target("avx2")
//#pragma GCC optimize("unroll-loops,Ofast")

using namespace std;

typedef long long ll;

#define pb       push_back
#define mp       make_pair
#define all(x)   x.begin(), x.end()
#define fi       first
#define se       second

const int maxn  =  1e6   + 10;
const int maxn5 =  5e5   + 10;
const int maxnt =  1e7;
const int maxn3 =  1e3   + 10;
const int mod   =  1e9   + 7;
const ll  inf   =  1e18;

int n, m;
ll a[maxn3][maxn3];


long long gcd2(long long X, long long Y) {
    long long tmp;
    while (X != Y && Y != 0) {
        tmp = X;
        X = Y;
        Y = tmp % Y;
    }
    return X;
}


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

void update(int x, int y, long long k) {
    a[x][y] = k;
}

long long calculate(int l, int d, int r, int u) {
    ll ans = 0;
    for(int i = l; i <= r; i++) for(int j = d; j <= u; j++)
        ans = gcd2(ans, a[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...