TopCoder

User's AC Ratio

100.0% (6/6)

Submission's AC Ratio

66.7% (8/12)

Tags

Description

Given 2D-points $A _ k=(x _ k, y _ k)$ $(k=0,1,\ldots ,N-1)$ and 2D-points $B _ k=(p _ k, q _ k)$ $(k=0,1,\ldots ,M-1)$ . Process the following $Q$ queries in order.

  • Given $a$ , $b$ , $c$ . Please output the number of points in $B _ 0,B _ 1,\ldots ,B _ {M-1}$ included in the convex hull of $3$ points $A _ a,A _ b,A _ c$ (exclude border) .

Input Format

$N$
$x _ 0$ $y _ 0$
$x _ 1$ $y _ 1$
$\ \vdots$
$x _ {N-1}$ $y _ {N-1}$
$M$
$p _ 0$ $q _ 0$
$p _ 1$ $q _ 1$
$\ \vdots$
$p _ {M-1}$ $q_{M-1}$
$Q$
$a$ $b$ $c$
$\ \vdots$
$a$ $b$ $c$

  • $1 \leq N \leq 2000$
  • $1 \leq M \leq 2000$
  • $|x _ i|, |y _ i| \leq 10^ 9$
  • $|p _ i|, |q _ i| \leq 10^ 9$
  • $1 \leq Q \leq 10^ 6$
  • $0 \leq a,b,c \lt N$
  • They are all integers.

Output Format

For each query, output the answer.

Sample Input 1

5
-1 -1
-1 2
2 -1
2 2
5 5
5
0 0
0 1
1 0
1 1
1 1
4
0 1 2
3 3 3
0 3 4
1 4 2

Sample Output 1

1
0
0
2

Hints

Problem Source

Library Checker 改

Subtasks

No. Testdata Range Score

Testdata and Limits

No. Time Limit (ms) Memory Limit (VSS, KiB) Output Limit (KiB) Subtasks
0 4000 1048576 65536
1 4000 1048576 65536
2 4000 1048576 65536
3 4000 1048576 65536
4 4000 1048576 65536
5 4000 1048576 65536
6 4000 1048576 65536
7 4000 1048576 65536
8 4000 1048576 65536
9 4000 1048576 65536