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

26497번 - Park 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 1024 MB26201684.211%

문제

You like looking at trees. A park has many trees. Therefore, you spend most of your waking hours at the park. You have an acute vision problem that severely limits your ability to look at these trees. The park has several paths that you can walk on. Each path is described by an infinite-length horizontal or vertical line in the 2D plane. No trees lie on a path. You want to know how many trees are visible in the park. Because of your vision problem, a tree is visible only if you can view it by standing on some path while facing in a direction perpendicular to that path. Of course all trees are equally wide, so if there is a second tree between the first tree and where you are currently standing, then you can’t see the first tree. Given location of all the trees and all the paths, determine how many trees you can view in the park.

입력

The first line in the data file is an integer that represents the number of data sets to follow. Each data set contains several lines. The first line contains two integers n and m, the number of trees and number of paths. The next n lines contains two integers x and y, which are the coordinates of the trees. The following m lines contains a line equation of the form x=a or y=a.

출력

Print the number of trees you can view.

제한

예제 입력 1

2
6 3
-1 3
4 2
6 2
6 3
6 4
4 3
x=0
y=-1
y=5
1 2
2 3
x=5
y=5

예제 출력 1

5
1

힌트

출처

School > PLU High School Programming Contest > PLU 2012 > Advanced 9번

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

출처

대학교 대회

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

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