Submission #531342

#TimeUsernameProblemLanguageResultExecution timeMemory
531342DJ035Game (IOI13_game)C++17
10 / 100
13103 ms3824 KiB
#include "game.h"
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,avx,avx2")
#include <bits/stdc++.h>
#define MEM 2222
#define sanic ios_base::sync_with_stdio(0)
#define x first
#define y second
#define pf push_front
#define pb push_back
#define all(v) v.begin(), v.end()
#define sz size()
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pi;
const ll INF = 1e9+7;
const ll MOD = 998244353;
ll gcd(ll a, ll b){
    if(a%b) return gcd(b, a%b);
    return b;
}
ll n,m;
ll a[MEM][MEM];
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 P, int Q, long long K) {
    a[P][Q] = K;
}

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