#P7934. [COCI 2007/2008 #5] JABUKE

[COCI 2007/2008 #5] JABUKE

Problem Description

Given the coordinates of the three vertices of a triangle and the coordinates of NN points, please calculate the area of the triangle and, among these NN points, how many points lie inside the triangle (including the boundary).

Input Format

The first three lines each contain two integers, representing the coordinates of one vertex of the triangle.

The next line contains one integer NN.

The next NN lines each contain two integers xi,yix_i,y_i, representing the coordinates of the ii-th point.

Output Format

The first line contains one real number, representing the area of the triangle, rounded to one decimal place.

The second line contains one integer, representing the number of points inside the triangle or on its boundary.

1 1
5 1
3 3
4
3 1
3 2
3 3
3 4 
4.0
3
3 2
5 4
1 6
3
2 4
3 5
4 3 
6.0
3
2 6
5 1
7 8
5
1 4
3 5
6 4
6 5
4 7 
15.5
2

Hint

For 100%100\% of the data, 1N1001\le N\le100, and all coordinates x,yx,y are positive integers less than 10310^3.

Hint: The area formula for a triangle with vertices (xA,yA)(x_A,y_A), (xB,yB)(x_B,y_B), and (xC,yC)(x_C,y_C) is:

$\dfrac{|x_A(y_B-y_C)+x_B(y_C-y_A)+x_C(y_A-y_B)|}{2}$

The score for this problem follows the original contest settings, with a full score of 3030 points.

Translated by ChatGPT 5