当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

5517:Triple

题目描述
Given the finite multi-set $A$ of $n$ pairs of integers, an another finite multi-set $B$ of $m$ triples of integers, we define the product of $A$ and $B$ as a multi-set

$C =A * B \\
= \{\langle a,c,d\rangle \mid \langle a,b\rangle\in A,~\langle c,d,e\rangle\in B~and~b=e\}$

For each $\langle a,b,c\rangle\in C$, its BETTER set is defined as

$BETTER_C(\langle a,b,c\rangle) = \\
\{ \langle u,v,w\rangle\in C \mid \langle u,v,w\rangle \neq \langle a,b,c\rangle,~u\ge a,~v\ge b,~w\ge c \}$

As a \textbf{multi-set} of triples, we define the TOP subset (as a multi-set as well) of $C$, denoted by $TOP(C)$, as

$TOP(C) = \{ \langle a,b,c\rangle\in C \mid BETTER_C(\langle a,b,c\rangle) = \emptyset \}$

You need to compute the size of $TOP(C)$.
输入解释
The input contains several test cases. The first line of the input is a single integer $t~(1\le t\le 10)$ which is the number of test case. Then $t$ test cases follow.

Each test case contains three lines. The first line contains two integers $n~(1\le n\le 10^5)$ and $m~(1\le m\le 10^5)$ corresponding to the size of $A$ and $B$ respectively.
The second line contains $2\times n$ nonnegative integers
\[a_1,b_1,a_2,b_2,\cdots,a_n,b_n\]
which describe the multi-set $A$, where $1\le a_i,b_i\le 10^5$.
The third line contains $3\times m$ nonnegative integers
\[c_1,d_1,e_1,c_2,d_2,e_3,\cdots,c_m,d_m,e_m\]
corresponding to the $m$ triples of integers in $B$, where $1\le c_i,d_i\le 10^3$ and $1\le e_i\le 10^5$.
输出解释
For each test case, you should output the size of set $TOP(C)$.
输入样例
2
5 9
1 1 2 2 3 3 3 3 4 2
1 4 1 2 2 1 4 1 1 1 3 2 3 2 2 4 1 2 2 4 3 3 2 3 4 1 3
3 4
2 7 2 7 2 7
1 4 7 2 3 7 3 2 7 4 1 7
输出样例
Case #1: 5
Case #2: 12
来自杭电HDUOJ的附加信息
Recommend wange2014

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-5517

最后修改于 2020-10-25T23:23:22+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
12000/6000MS(Java/Others) 65536/65536K(Java/Others)