답안 #52617

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
52617 2018-06-26T09:22:20 Z ernestvw 새 집 (APIO18_new_home) C++11
5 / 100
5000 ms 9100 KB
#include <bits/stdc++.h>
using namespace std;

const int oo = 1e9;

struct Store {
	int x, t, a, b;
};

int n, k, q;
Store stores[400000];
int mini[400000];

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);

	cin >> n >> k >> q;
	for(int i = 0; i < n; i++) cin >> stores[i].x >> stores[i].t >> stores[i].a >> stores[i].b;
	
	while(q--) {
		int l, y;
		cin >> l >> y;
		for(int i = 1; i <= k; i++) mini[i] = +oo;
		for(int i = 0; i < n; i++)
			if(stores[i].a <= y and y <= stores[i].b)
				mini[stores[i].t] = min(mini[stores[i].t], abs(l - stores[i].x));
		int inconvenience = 0;
		for(int i = 1; i <= k; i++) inconvenience = max(inconvenience, mini[i]);
		if(inconvenience == +oo) inconvenience = -1;
		cout << inconvenience << '\n';
	}
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 440 KB Output is correct
4 Correct 2 ms 492 KB Output is correct
5 Correct 3 ms 496 KB Output is correct
6 Correct 3 ms 536 KB Output is correct
7 Correct 3 ms 576 KB Output is correct
8 Correct 3 ms 608 KB Output is correct
9 Correct 3 ms 696 KB Output is correct
10 Correct 3 ms 696 KB Output is correct
11 Correct 3 ms 752 KB Output is correct
12 Correct 2 ms 884 KB Output is correct
13 Correct 3 ms 884 KB Output is correct
14 Correct 3 ms 884 KB Output is correct
15 Correct 3 ms 884 KB Output is correct
16 Correct 4 ms 968 KB Output is correct
17 Correct 3 ms 968 KB Output is correct
18 Correct 3 ms 980 KB Output is correct
19 Correct 3 ms 1004 KB Output is correct
20 Correct 3 ms 1152 KB Output is correct
21 Correct 4 ms 1152 KB Output is correct
22 Correct 4 ms 1152 KB Output is correct
23 Correct 4 ms 1160 KB Output is correct
24 Correct 4 ms 1180 KB Output is correct
25 Correct 3 ms 1200 KB Output is correct
26 Correct 4 ms 1252 KB Output is correct
27 Correct 3 ms 1252 KB Output is correct
28 Correct 2 ms 1252 KB Output is correct
29 Correct 3 ms 1268 KB Output is correct
30 Correct 2 ms 1292 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 440 KB Output is correct
4 Correct 2 ms 492 KB Output is correct
5 Correct 3 ms 496 KB Output is correct
6 Correct 3 ms 536 KB Output is correct
7 Correct 3 ms 576 KB Output is correct
8 Correct 3 ms 608 KB Output is correct
9 Correct 3 ms 696 KB Output is correct
10 Correct 3 ms 696 KB Output is correct
11 Correct 3 ms 752 KB Output is correct
12 Correct 2 ms 884 KB Output is correct
13 Correct 3 ms 884 KB Output is correct
14 Correct 3 ms 884 KB Output is correct
15 Correct 3 ms 884 KB Output is correct
16 Correct 4 ms 968 KB Output is correct
17 Correct 3 ms 968 KB Output is correct
18 Correct 3 ms 980 KB Output is correct
19 Correct 3 ms 1004 KB Output is correct
20 Correct 3 ms 1152 KB Output is correct
21 Correct 4 ms 1152 KB Output is correct
22 Correct 4 ms 1152 KB Output is correct
23 Correct 4 ms 1160 KB Output is correct
24 Correct 4 ms 1180 KB Output is correct
25 Correct 3 ms 1200 KB Output is correct
26 Correct 4 ms 1252 KB Output is correct
27 Correct 3 ms 1252 KB Output is correct
28 Correct 2 ms 1252 KB Output is correct
29 Correct 3 ms 1268 KB Output is correct
30 Correct 2 ms 1292 KB Output is correct
31 Execution timed out 5023 ms 5180 KB Time limit exceeded
32 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 5045 ms 9100 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 5016 ms 9100 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 440 KB Output is correct
4 Correct 2 ms 492 KB Output is correct
5 Correct 3 ms 496 KB Output is correct
6 Correct 3 ms 536 KB Output is correct
7 Correct 3 ms 576 KB Output is correct
8 Correct 3 ms 608 KB Output is correct
9 Correct 3 ms 696 KB Output is correct
10 Correct 3 ms 696 KB Output is correct
11 Correct 3 ms 752 KB Output is correct
12 Correct 2 ms 884 KB Output is correct
13 Correct 3 ms 884 KB Output is correct
14 Correct 3 ms 884 KB Output is correct
15 Correct 3 ms 884 KB Output is correct
16 Correct 4 ms 968 KB Output is correct
17 Correct 3 ms 968 KB Output is correct
18 Correct 3 ms 980 KB Output is correct
19 Correct 3 ms 1004 KB Output is correct
20 Correct 3 ms 1152 KB Output is correct
21 Correct 4 ms 1152 KB Output is correct
22 Correct 4 ms 1152 KB Output is correct
23 Correct 4 ms 1160 KB Output is correct
24 Correct 4 ms 1180 KB Output is correct
25 Correct 3 ms 1200 KB Output is correct
26 Correct 4 ms 1252 KB Output is correct
27 Correct 3 ms 1252 KB Output is correct
28 Correct 2 ms 1252 KB Output is correct
29 Correct 3 ms 1268 KB Output is correct
30 Correct 2 ms 1292 KB Output is correct
31 Execution timed out 5023 ms 5180 KB Time limit exceeded
32 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 440 KB Output is correct
4 Correct 2 ms 492 KB Output is correct
5 Correct 3 ms 496 KB Output is correct
6 Correct 3 ms 536 KB Output is correct
7 Correct 3 ms 576 KB Output is correct
8 Correct 3 ms 608 KB Output is correct
9 Correct 3 ms 696 KB Output is correct
10 Correct 3 ms 696 KB Output is correct
11 Correct 3 ms 752 KB Output is correct
12 Correct 2 ms 884 KB Output is correct
13 Correct 3 ms 884 KB Output is correct
14 Correct 3 ms 884 KB Output is correct
15 Correct 3 ms 884 KB Output is correct
16 Correct 4 ms 968 KB Output is correct
17 Correct 3 ms 968 KB Output is correct
18 Correct 3 ms 980 KB Output is correct
19 Correct 3 ms 1004 KB Output is correct
20 Correct 3 ms 1152 KB Output is correct
21 Correct 4 ms 1152 KB Output is correct
22 Correct 4 ms 1152 KB Output is correct
23 Correct 4 ms 1160 KB Output is correct
24 Correct 4 ms 1180 KB Output is correct
25 Correct 3 ms 1200 KB Output is correct
26 Correct 4 ms 1252 KB Output is correct
27 Correct 3 ms 1252 KB Output is correct
28 Correct 2 ms 1252 KB Output is correct
29 Correct 3 ms 1268 KB Output is correct
30 Correct 2 ms 1292 KB Output is correct
31 Execution timed out 5023 ms 5180 KB Time limit exceeded
32 Halted 0 ms 0 KB -