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

19198번 - Ambitious Plan 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
4 초 512 MB822100.000%

문제

Steven Sleepberg is going to produce the forty seventh sequel to his film "Battlefield Jupiter" and is now planning the main battle scene. The script of the scene says that $n$ empire drones would attack $m$ republic forts. The attack proceeds as follows: a drone shoots the laser cannon towards one of the forts. The defense in turn has $t$ power towers, and one pair of towers creates a power shield. The power shield is a segment connecting the two towers. If the shield intersects the segment which connects the shooting drone with its target a spectacular explosion takes place.

Steven wants the scene to be as spectacular as possible. So he wants to film all possible pairs of shoot and shield that cause explosion. Help him to estimate the length of the scene by counting the number of possible explosions.

Let us consider drones, forts and power towers as points on a plane. The line of defense coincides with the line $y = 0,ドル so $y$-coordinates of all forts and towers are less than 0, and $y$-coordinates of all drones are greater than 0. You are given coordinates of $n$ drones, $m$ forts and $t$ towers. Find the number of sets $\{D, F, T_1, T_2\}$ such that $D$ is drone, $F$ is fort, $T_1$ and $T_2$ are towers, and segments $DF$ and $T_1T_2$ intersect. No two points coincide, no three points are on the same line.

입력

The input file contains multiple test cases.

Each test case starts with $n$ --- the number of drones (1ドル \le n \le 1500$), $n$ lines follow, each line contains $dx_i, dy_i$ --- coordinates of a drone. Integer $m$ --- the number of forts (1ドル \le m \le 1500$) --- follows, with $m$ more lines, each line contains $fx_i, fy_i$ --- coordinates of a fort. Finally there goes $t$ --- the number of towers (2ドル \le t \le 1500$) followed by $t$ lines, each line contains $tx_i, ty_i$ --- coordinates of a tower.

All drones coordinates satisfy $-10^9\le dx_i\le 10^9,ドル 0ドル< dy_i\le 10^9$. All forts and towers coordinates satisfy $-10^9\le fx_i, tx_i\le 10^9,ドル $-10^9 \le fy_i, ty_i < 0$.

Input is followed by a line containing a single zero.

The total number of drones in the input file is at most 1500ドル$. The total number of forts in the input file is at most 1500ドル$. The total number of towers in the input file is at most 1500ドル$.

출력

For each test case print one integer: the number of possible pairs of shoot-shield that cause an explosion.

제한

예제 입력 1

3
1 12
10 30
30 10
1
10 -10
4
2 -11
9 -1
11 -1
15 -14
0

예제 출력 1

7

힌트

출처

Camp > Petrozavodsk Programming Camp > Winter 2015 > Day 8: Andrew Stankevich Contest 47 A번

Contest > Open Cup > 2014/2015 Season > Stage 7: Northern Grand Prix A번

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

출처

대학교 대회

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

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