Kattis - pizzahawaii 【状态标记】

该博客介绍了如何解决Kattis上的Pizzahawaii问题,这是一个关于通过比较意大利语和英语菜单来寻找可能的食材对应关系的题目。作者指出由于语法差异,简单的单词对应并不奏效,而是需要考虑单词在不同菜单中出现的状态。通过引入状态标记(使用二进制表示食材在各菜单中是否出现),可以确定哪些食材可能存在对应关系。
摘要由CSDN通过智能技术生成

Kattis - pizzahawaii 【状态标记】

Description
You are travelling in a foreign country. Although you are also open to eat some regional food, you just cannot resist after you have found an Italian restaurant which offers pizza. Unfortunately the menu is written in the foreign language, so the list of ingredients of the pizzas are incomprehensible to you. What will you do?

One thing that you notice is that each pizza has an Italian name, which sounds quite familiar to you. You even remember for each named pizza what the ingredients of this pizza usually are. You want to use that information to figure out what the possible meaning of each word on the list of ingredients is.
Input

The first line of the input gives the number of test cases t
(0< t≤20). The first line of each input gives the number n of pizzas on the menu (1≤n≤60). The following 3⋅n lines describe the pizzas on the menu. Each pizza description starts with one line containing the name of the pizza. The name of the pizza consists of between 3 and 20 uppercase and lowercase letters. The next line starts with an integer mi, giving the number of ingredients of the pizza on the menu (1≤mi≤20). The rest of the line contains the mi ingredients separated by spaces. Each ingredient is a word consisting of between 2 and 20

lowercase letters. The third line of each pizza description gives the ingredients in your native language in the same format. Note that the number of ingredients may differ, because each restaurant may use slightly different ingredients for pizzas with the same name, so the ingredients you remember for a pizza with that name may not match the actual ingredients.
Output

For each test case print all pairs of words (w1,w2
) where w1 is an ingredient in the foreign language that could be the same ingredient as w2 because w1 and w2 appear on the same set of pizzas. Sort the

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值