1121 Damn Single (25 分)
“Damn Single (单身狗)” is the Chinese nickname for someone who is being single. You are supposed to find those who are alone in a big party, so they can be taken care of.
Input Specification:
Each input file contains one test case. For each case, the first line gives a positive integer N (≤ 50,000), the total number of couples. Then N lines of the couples follow, each gives a couple of ID’s which are 5-digit numbers (i.e. from 00000 to 99999). After the list of couples, there is a positive integer M (≤ 10,000) followed by M ID’s of the party guests. The numbers are separated by spaces. It is guaranteed that nobody is having bigamous marriage (重婚) or dangling with more than one companion.
Output Specification:
First print in a line the total number of lonely guests. Then in the next line, print their ID’s in increasing order. The numbers must be separated by exactly 1 space, and there must be no extra space at the end of the line.
Sample Input:
1 | 3 |
Sample Output:
1 | 5 |
作者: CHEN, Yue
单位: 浙江大学
时间限制: 200 ms
内存限制: 64 MB
代码长度限制: 16 KB
题目大意
给出情侣的名单以及聚会的名单,要求找出聚会中的单身狗。纯单身狗以及伴侣没出现的都算单身狗。
分析
用match数组保存情侣配对关系,map
代码
1 |
|
其他
这题最后不能输出多余空行,否则测试点1格式错误。然而1101 Quick Sort (25 分)里面必须输出空行。。无语了