4 人解决,7 人已尝试。
4 份提交通过,共有 14 份提交。
8.0 EMB 奖励。
单点时限: 2.0 sec
内存限制: 256 MB
Luigi’s Tavern is a thriving tavern in the Kingdom of Nahaila. The owner of the tavern Luigi supports to organize a party, because the main customers of the tavern are adventurers. Each adventurer has a job: hero, warrior, cleric or mage.
Any party should meet the following conditions:
Now, the tavern has H heroes, W warriors, C clerics and M mages. Your job is to write a program to find the maximum number of parties they can form.
The first line of the input contains 7 non-negative integers H, W, C, M, NW, NC, and NM, each of which is less than or equals to 50. The i-th of the following W lines contains the list of heroes who will be getting along with the warrior i. The list begins with a non-negative integer ni, less than or equals to H. Then the rest of the line should contain ni positive integers, each of which indicates the ID of a hero getting along with the warrior i.
After these lists, the following C lines contain the lists of warriors getting along with the clerics in the same manner. The j-th line contains a list of warriors who will be getting along with the cleric j. Then the last M lines of the input contain the lists of clerics getting along with the mages, of course in the same manner. The k-th line contains a list of clerics who will be getting along with the mage k.
You should output the maximum number of parties possible.
2 1 1 1 1 1 1 1 1 1 1 1 1 /* 1 1 1 1 0 0 0 1 1 1 1 1 1 1 0 1 0 1 0 1 0 1 1 0 1 0 1 0 0 0 1 1 0 1 0 1 0 1 1 0 */
2 /* 1 1 0 1 */
4 人解决,7 人已尝试。
4 份提交通过,共有 14 份提交。
8.0 EMB 奖励。