Universal Cup Judging System

Universal Cup

Time Limit: 1.0 s Memory Limit: 512 MB Total points: 100 Hackable ✓
Statistics

一个矩形板的边平行于坐标轴,位于二维平面上。该区域的左下角坐标为 $(0, 0)$,右上角坐标为 $(H, W)$。

给定三张矩形卡片,你需要将这三张卡片完全放置在板内以覆盖整个板,并求出不同放置方案的数量。在此过程中,卡片不能旋转或翻转,每张卡片的边必须平行于坐标轴,且每张卡片的顶点坐标必须为整数。

当且仅当存在某张卡片在两种放置方案中的位置不同时,我们认为这两种放置方案是不同的。由于答案可能很大,请输出其对 $10^9 + 7$ 取模的结果。

输入格式

输入包含多个测试用例,第一行包含一个整数 $T$ ($1 \le T \le 10^5$),表示测试用例的数量。

对于每个测试用例: 第一行包含两个整数 $H$ 和 $W$ ($1 \le H, W \le 10^9$),表示矩形板的高度和宽度。 接下来三行,第 $i$ 行包含两个整数 $h_i$ ($1 \le h_i \le H$) 和 $w_i$ ($1 \le w_i \le W$),表示第 $i$ 张矩形卡片的高度和宽度。

输出格式

对于每个测试用例,输出一行包含一个整数,表示满足条件的放置方案数量,对 $10^9 + 7$ 取模。

样例

输入 1

5
2 2
1 1
1 1
1 1
2 2
1 1
1 2
1 2
2 2
1 1
1 2
2 1
2 2
1 2
1 2
1 2
2 2
1 2
1 2
2 1

输出 1

0
8
4
6
4

输入 2

4
1 3
1 1
1 2
1 3
1 4
1 1
1 2
1 3
1 5
1 1
1 2
1 3
1 6
1 1
1 2
1 3

输出 2

6
12
14
6

输入 3

1
1000000000 1000000000
1 1
1 1
1000000000 1000000000

输出 3

2401

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.