제출 #578960

#제출 시각아이디문제언어결과실행 시간메모리
578960Belgutei게임 (IOI13_game)C++17
10 / 100
2 ms468 KiB
#include "game.h"
#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define ff first
#define ss second
#define pb push_back
#define mk make_pair

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;
}

long long x[200][200];

void init(int R, int C) {
    /* ... */
}

void update(int P, int Q, long long K) {
    /* ... */
    x[P][Q] = K;
}

long long calculate(int P, int Q, int U, int V) {
    /* ... */
    long long ret = 0;
    for(int i = P; i <= U; i ++) {
        for(int j = Q; j <= V; j ++) {
            if(x[i][j] == 0) continue;
            if(ret == 0) {ret = x[i][j]; continue;}
            ret = gcd2(ret, x[i][j]);
        }
    }
    return ret;
}
#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...