Problem G |
Game of Rectangles |
Time Limit :
7 seconds |
||||
Arif and Nadia are playing a two player game. The game has following rules -
Note that, A rectangle can be represented as (x1, y1, x2, y2), where (x1,
y1) is the lower left corner and (x2, y2) is the upper right corner. So, the
height of the rectangle is y2 - y1 and width of the rectangle is x2 - x1,
and area of the rectangle is (y2-y1)*(x2-x1). |
||||||
Input | ||||||
The first line of input is an integer T(T<=100)
that indicates the number of test cases. Each case will starts with a line
containing two integer, W (1<=W<=1000000000) width of the
board and H(1<=H<=1000000000) height of the board. Next Line will
contain 4 integers, MaxWidth, MinWidth, MaxHeight,
MinHeight. This line will be followed by another line containing a
single integer K(0<=K<=50), the number of rectangles placed in the
board. Next K line will represents one rectangle each. Each rectangle
will be represented with 4 space separated integer values (x1, y1, x2,
y2), as described above. There is a blank line between two test cases.. |
||||||
Output | ||||||
For each test case, output will be a single line containing N, the number of ways to place a rectangle in that board modulo 1000000007. | ||||||
Sample Input | Sample Output | |||||
2 20 10 2 2 5 4 2 10 5 11 6 4 4 5 5 20 10 2 2 5 4 1 10 5 11 6 |
211 229 |
|||||
Problem Setter: Md. Arifuzzaman Arif |