SP17944 MMMAGIC4 - Mickey Mouse Magic Trick v4

题目描述

在这道题中,我们使用固定的值 $n=27$ 和 $k=4$。还有其他问题涉及不同的值:[MMMAGIC3](../../problems/MMMAGIC3/)、[MMMAGIC5](../../problems/MMMAGIC5/)、[MMMAGIC6](../../problems/MMMAGIC6/)。 ### 输入格式 输入的第一行包含两个整数 $M$ 和 $D$,分别代表米奇和唐老鸭需要帮助的测试用例数目,其中 $M+D < 40000$。 接下来的 $M$ 行,每行给出 $k$ 个从 $1$ 到 $n$ 之间不重复的整数,表示米奇收到的卡片上的数值。这些数值是随机排列的。 接下来的 $D$ 行,每行给出 $k-1$ 个从 $1$ 到 $n$ 之间不重复的整数,表示唐老鸭桌上剩余卡片的数值。这些数值按照桌面上的顺序排列,从左到右。 ### 输出格式 对每一个米奇的查询,输出一行,包括 $k-1$ 个整数,表示米奇需要放在桌上的卡片数值,从左到右排列。 对每一个唐老鸭的查询,输出一行,包含一个整数,表示隐藏卡片的数值。如果根据策略无法得出唯一结果,可输出任意一个剩余的数值。 **本翻译由 AI 自动生成**

输入格式

All integers in the same line are single-space separated (the same concerns problem output). Values n, k are constant. In this problem n=27 and k=4. There are also problems with different values: [MMMAGIC3](../../problems/MMMAGIC3/), [MMMAGIC5](../../problems/MMMAGIC5/), [MMMAGIC6](../../problems/MMMAGIC6/) The first line of input contains two integers M, D, where M is the number of test cases in which Mickey needs help, D is the number of test cases in which Donald needs help (M+D < 40000). Every of next M lines contains k distinct integers from range \[1, n\] - the values on cards given to Mickey. The order of values is casual. Every of next D lines contains k-1 distinct integers from range \[1, n\] - the cards left to Donald on the table. The order is the same, as on the table, from left to right.

输出格式

For each Mickey's query write a line with k-1 integers - the values on the cards, that Mickey have to leave on the table, from left to right. For each Donald's query write a line with one integer - the value of hidden card or (if in Your strategy such situation is impossible) any of remaining values.