Punch Game

Time Limit
1s
Memory Limit
32768KB
Judge Program
Standard
Ratio(Solve/Submit)
11.11%(2/18)
Description:

There are n * m students standing in a matrix of n rows and m columns. Select 3 students from the matrix and draw a rope to form a closed polygon. If a student stands in a closed polygon (excluding the edges) made of rope, then the student is selected.
Now I need you to help me figure out how many students have been selected?

Input:

First line contains a positive integer t (t <= 10), the number of test cases.
In each test case, the first line contains three integers n, m. Then comes 3 lines of data, each line containing two positive integers x, y, the positions of 3 students.

Output:

For each test case output a single line containing a positive integer, number of selected students.

Sample Input:
2
5 5
2 2
2 4
4 3
2 2
1 1
1 2
2 2
Sample Output:
1
0

Submit