Submission #375707

# Submission time Handle Problem Language Result Execution time Memory
375707 2021-03-09T18:30:32 Z vot808 Game (IOI13_game) C++17
10 / 100
13000 ms 3552 KB
#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

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 time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 1 ms 376 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 1 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Execution timed out 13095 ms 3552 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Execution timed out 13076 ms 3184 KB Time limit exceeded
13 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Execution timed out 13003 ms 3440 KB Time limit exceeded
13 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 492 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Execution timed out 13070 ms 3512 KB Time limit exceeded
13 Halted 0 ms 0 KB -