POJ 1692 Crossed Matchings
来源:互联网 发布:java web 文件下载 编辑:程序博客网 时间:2024/04/20 17:52
Crossed Matchings
Time Limit: 1000MS Memory Limit: 10000KTotal Submissions: 1578 Accepted: 1020
Description
There are two rows of positive integer numbers. We can draw one line segment between any two equal numbers, with values r, if one of them is located in the first row and the other one is located in the second row. We call this line segment an r-matching segment. The following figure shows a 3-matching and a 2-matching segment.
We want to find the maximum number of matching segments possible to draw for the given input, such that:
1.Each a-matching segment should cross exactly one b-matching segment, where a != b .
2.No two matching segments can be drawn from a number. For example, the following matchings are not allowed.
Write a program to compute the maximum number of matching segments for the input data. Note that this number is always even.
We want to find the maximum number of matching segments possible to draw for the given input, such that:
1.Each a-matching segment should cross exactly one b-matching segment, where a != b .
2.No two matching segments can be drawn from a number. For example, the following matchings are not allowed.
Write a program to compute the maximum number of matching segments for the input data. Note that this number is always even.
Input
The first line of the input is the number M, which is the number of test cases (1 <= M <= 10). Each test case has three lines. The first line contains N1 and N2, the number of integers on the first and the second row respectively. The next line contains N1 integers which are the numbers on the first row. The third line contains N2 integers which are the numbers on the second row. All numbers are positive integers less than 100.
Output
Output should have one separate line for each test case. The maximum number of matching segments for each test case should be written in one separate line.
Sample Input
36 61 3 1 3 1 33 1 3 1 3 14 41 1 3 3 1 1 3 3 12 111 2 3 3 2 4 1 5 1 3 5 103 1 2 3 2 4 12 1 5 5 3
Sample Output
608
Source
Tehran 1999
- POJ 1692 Crossed Matchings
- poj 1692 Crossed Matchings
- POJ 1692 Crossed Matchings
- POJ 1692 Crossed Matchings
- POJ 1692 Crossed Matchings(dp).
- POJ 1692 Crossed Matchings(DP)
- POJ 1692 Crossed Matchings(DP)
- POJ 1692 Crossed Matchings(DP)
- poj 1692 Crossed Matchings DP
- poj 1692 Crossed Matchings(DP)
- poj 1692 Crossed Matchings 动态规划
- POJ 1692 Crossed Matchings (DP) #by Plato
- poj 1692 Crossed Matchings 动态规划
- POJ 1692 Crossed Matchings(DP)
- 【poj 1692】Crossed Matchings (最长公共子序列变形)
- PKU1692 Crossed Matchings
- pku1692 Crossed Matchings
- ZOJ1425 POJ1692 Crossed Matchings
- HASH JOIN
- FLEX实践—动态应用Validator验证多组数据
- VMware server 4.0 安装与使用教程
- Linux网络编程
- USB产品序列号获取方法
- POJ 1692 Crossed Matchings
- Convert HTML to Plain Text (把HTML文本转换成纯文本)
- 微软云计算定义:云+端、软件+服务
- PAGED_CODE
- 留学申请总结 - 计算机
- Android数据存储(总结篇)
- POJ 1691 Painting A Board
- Java WS和二进制数据传送
- 软件即服务已经过时 硬件即服务促成云计算