Submission #411610

#TimeUsernameProblemLanguageResultExecution timeMemory
411610MlxaGame (IOI13_game)C++14
10 / 100
13102 ms16952 KiB
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define all(x) x.begin(), x.end()
#define mp make_pair
#define mt make_tuple
#define x first
#define y second
#include "game.h"

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

const int NN = 2020;

ll a[NN][NN];
vector<pair<int, int>> pa;


void init(int r, int c) {
	(void)r; (void)c;
}

void update(int p, int q, ll k) {
	pa.emplace_back(p, q);
	a[p][q] = k;
}

ll calculate(int p, int q, int u, int v) {
	ll ans = 0;
	for (auto e : pa) {
		if (p <= e.x && e.x <= u && q <= e.y && e.y <= v) {
			ans = gcd(ans, a[e.x][e.y]);
		}
	}
	return ans;
}

#ifdef LC
#include "grader.c"
#endif
#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...