답안 #71952

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
71952 2018-08-26T03:23:36 Z KLPP 새 집 (APIO18_new_home) C++14
5 / 100
5000 ms 24780 KB
#include<iostream>
#include<stdio.h>
#include<vector>
#include<queue>
#include<algorithm>

using namespace std;
typedef long long int lld;
int abs(int x){
	if(x>0)return x;
	return -x;
}
int main(){
	int n,q,k;
	cin>>n>>k>>q;
	int stores[n][4];
	for(int i=0;i<n;i++){
		cin>>stores[i][0]>>stores[i][1]>>stores[i][2]>>stores[i][3];
	}
	/*for(int i=0;i<n;i++){
		cout<<stores[i][0]<<stores[i][1]<<stores[i][2]<<stores[i][3]<<endl;
	}cout<<endl;*/
	while(q--){
		int x,y;
		cin>>x>>y;
		int best[k];	
		for(int i=0;i<k;i++)best[i]=100000001;
		for(int i=0;i<n;i++){//cout<<stores[i][2]<<" "<<stores[i][3]<<endl;
if(stores[i][2]<=y && y<=stores[i][3]){//cout<<i<<" ";
	best[stores[i][1]-1]=min(best[stores[i][1]-1],abs(x-stores[i][0]));
}
		}//cout<<endl;
		int ans=0;
		for(int i=0;i<k;i++){
			ans=max(ans,best[i]);
			//cout<<best[i]<<" ";
		}
		if(ans<100000001)cout<<ans<<endl;
		else cout<<-1<<endl;
	}
	

	return 0;	
}
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 248 KB Output is correct
2 Correct 2 ms 360 KB Output is correct
3 Correct 2 ms 472 KB Output is correct
4 Correct 2 ms 584 KB Output is correct
5 Correct 5 ms 624 KB Output is correct
6 Correct 5 ms 884 KB Output is correct
7 Correct 6 ms 884 KB Output is correct
8 Correct 8 ms 884 KB Output is correct
9 Correct 8 ms 884 KB Output is correct
10 Correct 6 ms 884 KB Output is correct
11 Correct 5 ms 908 KB Output is correct
12 Correct 6 ms 924 KB Output is correct
13 Correct 4 ms 1064 KB Output is correct
14 Correct 6 ms 1064 KB Output is correct
15 Correct 4 ms 1064 KB Output is correct
16 Correct 4 ms 1064 KB Output is correct
17 Correct 5 ms 1064 KB Output is correct
18 Correct 6 ms 1064 KB Output is correct
19 Correct 5 ms 1064 KB Output is correct
20 Correct 5 ms 1212 KB Output is correct
21 Correct 4 ms 1212 KB Output is correct
22 Correct 4 ms 1212 KB Output is correct
23 Correct 6 ms 1212 KB Output is correct
24 Correct 7 ms 1212 KB Output is correct
25 Correct 5 ms 1212 KB Output is correct
26 Correct 4 ms 1216 KB Output is correct
27 Correct 6 ms 1236 KB Output is correct
28 Correct 4 ms 1244 KB Output is correct
29 Correct 5 ms 1264 KB Output is correct
30 Correct 5 ms 1284 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 248 KB Output is correct
2 Correct 2 ms 360 KB Output is correct
3 Correct 2 ms 472 KB Output is correct
4 Correct 2 ms 584 KB Output is correct
5 Correct 5 ms 624 KB Output is correct
6 Correct 5 ms 884 KB Output is correct
7 Correct 6 ms 884 KB Output is correct
8 Correct 8 ms 884 KB Output is correct
9 Correct 8 ms 884 KB Output is correct
10 Correct 6 ms 884 KB Output is correct
11 Correct 5 ms 908 KB Output is correct
12 Correct 6 ms 924 KB Output is correct
13 Correct 4 ms 1064 KB Output is correct
14 Correct 6 ms 1064 KB Output is correct
15 Correct 4 ms 1064 KB Output is correct
16 Correct 4 ms 1064 KB Output is correct
17 Correct 5 ms 1064 KB Output is correct
18 Correct 6 ms 1064 KB Output is correct
19 Correct 5 ms 1064 KB Output is correct
20 Correct 5 ms 1212 KB Output is correct
21 Correct 4 ms 1212 KB Output is correct
22 Correct 4 ms 1212 KB Output is correct
23 Correct 6 ms 1212 KB Output is correct
24 Correct 7 ms 1212 KB Output is correct
25 Correct 5 ms 1212 KB Output is correct
26 Correct 4 ms 1216 KB Output is correct
27 Correct 6 ms 1236 KB Output is correct
28 Correct 4 ms 1244 KB Output is correct
29 Correct 5 ms 1264 KB Output is correct
30 Correct 5 ms 1284 KB Output is correct
31 Execution timed out 5088 ms 5096 KB Time limit exceeded
32 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 5091 ms 17224 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 5027 ms 24780 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 248 KB Output is correct
2 Correct 2 ms 360 KB Output is correct
3 Correct 2 ms 472 KB Output is correct
4 Correct 2 ms 584 KB Output is correct
5 Correct 5 ms 624 KB Output is correct
6 Correct 5 ms 884 KB Output is correct
7 Correct 6 ms 884 KB Output is correct
8 Correct 8 ms 884 KB Output is correct
9 Correct 8 ms 884 KB Output is correct
10 Correct 6 ms 884 KB Output is correct
11 Correct 5 ms 908 KB Output is correct
12 Correct 6 ms 924 KB Output is correct
13 Correct 4 ms 1064 KB Output is correct
14 Correct 6 ms 1064 KB Output is correct
15 Correct 4 ms 1064 KB Output is correct
16 Correct 4 ms 1064 KB Output is correct
17 Correct 5 ms 1064 KB Output is correct
18 Correct 6 ms 1064 KB Output is correct
19 Correct 5 ms 1064 KB Output is correct
20 Correct 5 ms 1212 KB Output is correct
21 Correct 4 ms 1212 KB Output is correct
22 Correct 4 ms 1212 KB Output is correct
23 Correct 6 ms 1212 KB Output is correct
24 Correct 7 ms 1212 KB Output is correct
25 Correct 5 ms 1212 KB Output is correct
26 Correct 4 ms 1216 KB Output is correct
27 Correct 6 ms 1236 KB Output is correct
28 Correct 4 ms 1244 KB Output is correct
29 Correct 5 ms 1264 KB Output is correct
30 Correct 5 ms 1284 KB Output is correct
31 Execution timed out 5088 ms 5096 KB Time limit exceeded
32 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 248 KB Output is correct
2 Correct 2 ms 360 KB Output is correct
3 Correct 2 ms 472 KB Output is correct
4 Correct 2 ms 584 KB Output is correct
5 Correct 5 ms 624 KB Output is correct
6 Correct 5 ms 884 KB Output is correct
7 Correct 6 ms 884 KB Output is correct
8 Correct 8 ms 884 KB Output is correct
9 Correct 8 ms 884 KB Output is correct
10 Correct 6 ms 884 KB Output is correct
11 Correct 5 ms 908 KB Output is correct
12 Correct 6 ms 924 KB Output is correct
13 Correct 4 ms 1064 KB Output is correct
14 Correct 6 ms 1064 KB Output is correct
15 Correct 4 ms 1064 KB Output is correct
16 Correct 4 ms 1064 KB Output is correct
17 Correct 5 ms 1064 KB Output is correct
18 Correct 6 ms 1064 KB Output is correct
19 Correct 5 ms 1064 KB Output is correct
20 Correct 5 ms 1212 KB Output is correct
21 Correct 4 ms 1212 KB Output is correct
22 Correct 4 ms 1212 KB Output is correct
23 Correct 6 ms 1212 KB Output is correct
24 Correct 7 ms 1212 KB Output is correct
25 Correct 5 ms 1212 KB Output is correct
26 Correct 4 ms 1216 KB Output is correct
27 Correct 6 ms 1236 KB Output is correct
28 Correct 4 ms 1244 KB Output is correct
29 Correct 5 ms 1264 KB Output is correct
30 Correct 5 ms 1284 KB Output is correct
31 Execution timed out 5088 ms 5096 KB Time limit exceeded
32 Halted 0 ms 0 KB -