답안 #59863

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
59863 2018-07-23T08:14:18 Z Eae02 새 집 (APIO18_new_home) C++14
5 / 100
5000 ms 13416 KB
#include <bits/stdc++.h>

#define ALL(x) x.begin(),x.end()

struct Store
{
	long pos;
	long type;
	long oYear;
	long cYear;
};

int main()
{
	long numStores, numTypes, numQ;
	std::cin >> numStores;
	std::cin >> numTypes;
	std::cin >> numQ;
	
	std::vector<Store> stores(numStores);
	for (long s = 0; s < numStores; s++)
	{
		std::cin >> stores[s].pos;
		std::cin >> stores[s].type;
		std::cin >> stores[s].oYear;
		std::cin >> stores[s].cYear;
		stores[s].type--;
	}
	
	std::vector<long> minDist(numTypes);
	
	for (long i = 0; i < numQ; i++)
	{
		long pos, year;
		std::cin >> pos;
		std::cin >> year;
		
		std::fill(ALL(minDist), -1);
		
		for (long s = 0; s < numStores; s++)
		{
			if (stores[s].cYear < year || stores[s].oYear > year)
				continue;
			long dist = std::abs(stores[s].pos - pos);
			long& curDist = minDist[stores[s].type];
			
			if (curDist == -1 || dist < curDist)
				curDist = dist;
		}
		
		long inconv = -1;
		for (long d : minDist)
		{
			if (d == -1)
			{
				inconv = -1;
				break;
			}
			inconv = std::max(inconv, d);
		}
		
		std::cout << inconv << std::endl;
	}
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 340 KB Output is correct
2 Correct 2 ms 360 KB Output is correct
3 Correct 1 ms 436 KB Output is correct
4 Correct 3 ms 480 KB Output is correct
5 Correct 5 ms 512 KB Output is correct
6 Correct 7 ms 704 KB Output is correct
7 Correct 6 ms 704 KB Output is correct
8 Correct 7 ms 720 KB Output is correct
9 Correct 7 ms 888 KB Output is correct
10 Correct 5 ms 940 KB Output is correct
11 Correct 5 ms 944 KB Output is correct
12 Correct 5 ms 944 KB Output is correct
13 Correct 5 ms 944 KB Output is correct
14 Correct 6 ms 948 KB Output is correct
15 Correct 5 ms 968 KB Output is correct
16 Correct 5 ms 988 KB Output is correct
17 Correct 5 ms 1008 KB Output is correct
18 Correct 6 ms 1028 KB Output is correct
19 Correct 5 ms 1044 KB Output is correct
20 Correct 5 ms 1068 KB Output is correct
21 Correct 5 ms 1088 KB Output is correct
22 Correct 7 ms 1232 KB Output is correct
23 Correct 7 ms 1232 KB Output is correct
24 Correct 7 ms 1232 KB Output is correct
25 Correct 6 ms 1232 KB Output is correct
26 Correct 7 ms 1232 KB Output is correct
27 Correct 4 ms 1232 KB Output is correct
28 Correct 6 ms 1232 KB Output is correct
29 Correct 5 ms 1232 KB Output is correct
30 Correct 5 ms 1252 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 340 KB Output is correct
2 Correct 2 ms 360 KB Output is correct
3 Correct 1 ms 436 KB Output is correct
4 Correct 3 ms 480 KB Output is correct
5 Correct 5 ms 512 KB Output is correct
6 Correct 7 ms 704 KB Output is correct
7 Correct 6 ms 704 KB Output is correct
8 Correct 7 ms 720 KB Output is correct
9 Correct 7 ms 888 KB Output is correct
10 Correct 5 ms 940 KB Output is correct
11 Correct 5 ms 944 KB Output is correct
12 Correct 5 ms 944 KB Output is correct
13 Correct 5 ms 944 KB Output is correct
14 Correct 6 ms 948 KB Output is correct
15 Correct 5 ms 968 KB Output is correct
16 Correct 5 ms 988 KB Output is correct
17 Correct 5 ms 1008 KB Output is correct
18 Correct 6 ms 1028 KB Output is correct
19 Correct 5 ms 1044 KB Output is correct
20 Correct 5 ms 1068 KB Output is correct
21 Correct 5 ms 1088 KB Output is correct
22 Correct 7 ms 1232 KB Output is correct
23 Correct 7 ms 1232 KB Output is correct
24 Correct 7 ms 1232 KB Output is correct
25 Correct 6 ms 1232 KB Output is correct
26 Correct 7 ms 1232 KB Output is correct
27 Correct 4 ms 1232 KB Output is correct
28 Correct 6 ms 1232 KB Output is correct
29 Correct 5 ms 1232 KB Output is correct
30 Correct 5 ms 1252 KB Output is correct
31 Execution timed out 5066 ms 5736 KB Time limit exceeded
32 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 5057 ms 13416 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 5097 ms 13416 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 340 KB Output is correct
2 Correct 2 ms 360 KB Output is correct
3 Correct 1 ms 436 KB Output is correct
4 Correct 3 ms 480 KB Output is correct
5 Correct 5 ms 512 KB Output is correct
6 Correct 7 ms 704 KB Output is correct
7 Correct 6 ms 704 KB Output is correct
8 Correct 7 ms 720 KB Output is correct
9 Correct 7 ms 888 KB Output is correct
10 Correct 5 ms 940 KB Output is correct
11 Correct 5 ms 944 KB Output is correct
12 Correct 5 ms 944 KB Output is correct
13 Correct 5 ms 944 KB Output is correct
14 Correct 6 ms 948 KB Output is correct
15 Correct 5 ms 968 KB Output is correct
16 Correct 5 ms 988 KB Output is correct
17 Correct 5 ms 1008 KB Output is correct
18 Correct 6 ms 1028 KB Output is correct
19 Correct 5 ms 1044 KB Output is correct
20 Correct 5 ms 1068 KB Output is correct
21 Correct 5 ms 1088 KB Output is correct
22 Correct 7 ms 1232 KB Output is correct
23 Correct 7 ms 1232 KB Output is correct
24 Correct 7 ms 1232 KB Output is correct
25 Correct 6 ms 1232 KB Output is correct
26 Correct 7 ms 1232 KB Output is correct
27 Correct 4 ms 1232 KB Output is correct
28 Correct 6 ms 1232 KB Output is correct
29 Correct 5 ms 1232 KB Output is correct
30 Correct 5 ms 1252 KB Output is correct
31 Execution timed out 5066 ms 5736 KB Time limit exceeded
32 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 340 KB Output is correct
2 Correct 2 ms 360 KB Output is correct
3 Correct 1 ms 436 KB Output is correct
4 Correct 3 ms 480 KB Output is correct
5 Correct 5 ms 512 KB Output is correct
6 Correct 7 ms 704 KB Output is correct
7 Correct 6 ms 704 KB Output is correct
8 Correct 7 ms 720 KB Output is correct
9 Correct 7 ms 888 KB Output is correct
10 Correct 5 ms 940 KB Output is correct
11 Correct 5 ms 944 KB Output is correct
12 Correct 5 ms 944 KB Output is correct
13 Correct 5 ms 944 KB Output is correct
14 Correct 6 ms 948 KB Output is correct
15 Correct 5 ms 968 KB Output is correct
16 Correct 5 ms 988 KB Output is correct
17 Correct 5 ms 1008 KB Output is correct
18 Correct 6 ms 1028 KB Output is correct
19 Correct 5 ms 1044 KB Output is correct
20 Correct 5 ms 1068 KB Output is correct
21 Correct 5 ms 1088 KB Output is correct
22 Correct 7 ms 1232 KB Output is correct
23 Correct 7 ms 1232 KB Output is correct
24 Correct 7 ms 1232 KB Output is correct
25 Correct 6 ms 1232 KB Output is correct
26 Correct 7 ms 1232 KB Output is correct
27 Correct 4 ms 1232 KB Output is correct
28 Correct 6 ms 1232 KB Output is correct
29 Correct 5 ms 1232 KB Output is correct
30 Correct 5 ms 1252 KB Output is correct
31 Execution timed out 5066 ms 5736 KB Time limit exceeded
32 Halted 0 ms 0 KB -