제출 #375708

#제출 시각아이디문제언어결과실행 시간메모리
375708vot808Game (IOI13_game)C++17
10 / 100
13102 ms6848 KiB
#include "bits/stdc++.h"
#include "game.h"
#ifdef mlocal
#include "grader.c"
#endif
using namespace std;
#define for_(i, s, e) for (int i = s; i < (int) e; i++)
#define for__(i, s, e) for (ll i = s; i < e; i++)
typedef long long ll;
typedef vector<int> vi;
typedef array<int, 2> ii;
#define endl '\n'

const int MXU = 22000;
map<ii, ll> updates;

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

void update(int P, int Q, long long K) {
	updates[{P, Q}] = K;
	// cu++;
}

long long calculate(int P, int Q, int U, int V) {
	ll g = 0;
	for (auto &v: updates) {
		if (v.first[0] < P) continue;
		else if (v.first[0] > U) break;
		else if (v.first[1] >= Q and v.first[1] <= V) {
			if (g == 0) g = v.second;
			else g = __gcd(g, v.second);
		}
	}
	
	
	return g;
}

#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...