답안 #987598

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
987598 2024-05-23T06:51:53 Z happypotato 게임 (IOI13_game) C++17
37 / 100
13000 ms 9256 KB
#include "game.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pii pair<int, int>
#define ff first
#define ss second
#define pb push_back
ll gcd(ll a, ll b) {
	while (b) b ^= a ^= b ^= a %= b;
	return a;
}
void init(int R, int C) {
	
}
vector<pair<pii, ll>> v;
void update(int P, int Q, long long K) {
	for (auto it = v.begin(); it != v.end(); ++it) {
		if (it->ff.ff == P && it->ff.ss == Q) {
			v.erase(it);
			break;
		}
	}
	v.pb({{P, Q}, K});
	// for (pair<pii, ll> &x : v) cerr << x.ff.ff << ' ' << x.ff.ss << ' ' << x.ss << endl;
	// cerr << endl;
}

long long calculate(int P, int Q, int U, int V) {
	if (P > U) swap(P, U);
	if (Q > V) swap(Q, V);
	ll res = 0;
	for (pair<pii, ll> &x : v) {
		if (P <= x.ff.ff && x.ff.ff <= U && Q <= x.ff.ss && x.ff.ss <= V) {
			res = gcd(res, x.ss);
		}
	}
	return res;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 604 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 432 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 9602 ms 8980 KB Output is correct
5 Correct 7200 ms 8864 KB Output is correct
6 Correct 6380 ms 6384 KB Output is correct
7 Correct 12512 ms 5948 KB Output is correct
8 Correct 2730 ms 6480 KB Output is correct
9 Correct 10204 ms 6096 KB Output is correct
10 Correct 12100 ms 5660 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 500 KB Output is correct
11 Correct 1 ms 344 KB Output is correct
12 Correct 11089 ms 8844 KB Output is correct
13 Execution timed out 13050 ms 5012 KB Time limit exceeded
14 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 756 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 ms 440 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 9583 ms 8972 KB Output is correct
13 Correct 7192 ms 8860 KB Output is correct
14 Correct 6351 ms 6648 KB Output is correct
15 Correct 12511 ms 6016 KB Output is correct
16 Correct 2695 ms 6396 KB Output is correct
17 Correct 10234 ms 6048 KB Output is correct
18 Correct 11989 ms 5660 KB Output is correct
19 Correct 10990 ms 9256 KB Output is correct
20 Execution timed out 13027 ms 5068 KB Time limit exceeded
21 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 432 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 600 KB Output is correct
8 Correct 1 ms 344 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 9563 ms 9012 KB Output is correct
13 Correct 7130 ms 9016 KB Output is correct
14 Correct 6362 ms 7100 KB Output is correct
15 Correct 12674 ms 5984 KB Output is correct
16 Correct 2695 ms 6560 KB Output is correct
17 Correct 10400 ms 6236 KB Output is correct
18 Correct 12182 ms 5740 KB Output is correct
19 Correct 11393 ms 8976 KB Output is correct
20 Execution timed out 13031 ms 5020 KB Time limit exceeded
21 Halted 0 ms 0 KB -