Logo
(追記) (追記ここまで)

5149번 - Map Interface 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB2581319355.357%

문제

Many public transit systems have online interfaces for figuring out the route you want to take. One principle of good user interface design here is that the system should show you all the relevant information, but no more, so you can zoom in on the important part. For a graphical user interface showing a system map, this means showing you a map containing all the stations you will cross, but as few extra stations as possible. On the other hand, most users are used to rectangular maps with uniform scale, so we will stick with that.

So here is the problem more concretely. You will be given the locations (as (x,y) coordinates) for all stations in the system. Then, you will also be given the list of stations (in order) that your line takes you through. You are to compute how many stations total will be in the smallest rectangle that contains your entire trip.

입력

The first line contains the number K of data sets. This is followed by K data sets, each of the following form:

The first line contains two integers n,m. 2 ≤ n ≤ 500 is the total number of stations in the system, and 2 ≤ m ≤ n the number of stations you travel through.

The next n lines give you pairs of integers xi yi, the coordinates of the ith station. The following line contains m integers, the stations you visit in order.

출력

For each data set, first output “Data Set x:” on a line by itself, where x is its number. Then, output the total number of stations visible in the smallest rectangle containing all of your trip. Each data set should be followed by a blank line.

제한

예제 입력 1

1
8 4
0 0
6 3
0 2
7 2
0 -1
4 4
1 4
3 5
1 7 6 2

예제 출력 1

Data Set 1:
5

힌트

출처

University > The USC Programming Contest > Spring 2010: Public Transportation E번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /