Submission #375707

#TimeUsernameProblemLanguageResultExecution timeMemory
375707vot808Game (IOI13_game)C++17
10 / 100
13095 ms3552 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;
ll updates[MXU][3];
int cu = 0;
map<ii, ll> mp;

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

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

long long calculate(int P, int Q, int U, int V) {
	mp.clear();
	
	ll g = 0;
	for_(i, 0, cu) if (updates[i][0] >= P and updates[i][1] >= Q and updates[i][0] <= U and updates[i][1] <= V) mp[{updates[i][0], updates[i][1]}] = updates[i][2];
	for (auto &v: mp) {
		if (g == 0) g = v.second;
		else g = __gcd(g, v.second);
	}
	
	return g;
}

Compilation message (stderr)

game.cpp: In function 'long long int calculate(int, int, int, int)':
game.cpp:32:126: warning: narrowing conversion of 'updates[i][0]' from 'll' {aka 'long long int'} to 'int' [-Wnarrowing]
   32 |  for_(i, 0, cu) if (updates[i][0] >= P and updates[i][1] >= Q and updates[i][0] <= U and updates[i][1] <= V) mp[{updates[i][0], updates[i][1]}] = updates[i][2];
      |                                                                                                                  ~~~~~~~~~~~~^
game.cpp:32:141: warning: narrowing conversion of 'updates[i][1]' from 'll' {aka 'long long int'} to 'int' [-Wnarrowing]
   32 |  for_(i, 0, cu) if (updates[i][0] >= P and updates[i][1] >= Q and updates[i][0] <= U and updates[i][1] <= V) mp[{updates[i][0], updates[i][1]}] = updates[i][2];
      |                                                                                                                                 ~~~~~~~~~~~~^
#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...