Submission #962652

#TimeUsernameProblemLanguageResultExecution timeMemory
962652stev2005Game (IOI13_game)C++17
10 / 100
13069 ms5292 KiB
#include "game.h"
#include<bits/stdc++.h>
using namespace std;
const int maxn =  2048;
int n, m;
long long a[maxn][maxn]; 

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) {
    //cerr << "init\n";
    n = R;
    m = C;
}

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

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