문제1470--Double seaweeds

1470: Double seaweeds

실행시간 제한: 1 Sec  메모리사용 제한: 128 MB
제출: 1  통과: 1
[제출] [채점기록] [묻고답하기] [만든사람:]

문제 설명

Raya was fishing when she found seaweed floating on the surface. (This tells us that she was fishing in the ocean.)
But suddenly, the seaweed had a beautiful and harmonious color. When she looked closely, she saw that there were two seaweeds overlapping in that area.
Raya was curious about the area of the harmonious area created by the two seaweeds overlapping.
Seaweed is a square shape parallel to the x-axis and y-axis on a 2D plane, and the two vertices connected diagonally are expressed as a total of four integers. (x and y-coordinate of the first vertex, x and y-coordinate of the second vertex in that order)

입력 설명

The input consists of several test cases. The first line contains the number of test cases, T. 
Starting from the second line, each line contains eight integers (greater than -10,000 and less than 10,000) representing two seaweed sheets, one test case. The first four integers represent the first seaweed sheet, and the last four integers represent the second seaweed sheet.

출력 설명

Print the answer to each test case, one per line.

입력 예시 Copy

2
1 1 3 3 2 2 4 4
1 1 2 2 3 3 4 4

출력 예시 Copy

1
0

출처/분류