22147_Party

2022-5-16 18:21| 发布者: Hocassian| 查看: 27| 评论: 0|原作者: 肇庆学院ACM合集

摘要:
C:\Users\Administrator\Downloads\2019-10-12-10-14-5-89506149562700-Problem List-采集的数据-后羿采集器.html

Pro.ID

22147

Title

Party

Title链接

http://10.20.2.8/oj/exercise/problem?problem_id=22147

AC

1

Submit

3

Ratio

33.33%

时间&空间限制

  • Time Limit: 2000/1000 MS (Java/Others)     Memory Limit: 65536/65536 K (Java/Others)
  • 描述

    Tzdin wants to organize a ball in the Christmas Eve. N women and M ( MN ) men intend to take part in the party. At the beginning of the party, tzdin gives each woman several cards on which the profiles of the men are presented. Then each woman can choose a man from the cards as her partner. We assume that finally with the guidance of tzdin, each woman can choose a man from her cards. Now, we want to know which men are sure to have a partner in the end, no matter how the women choose nor how tzdin guaides.

    输入

    The first line contains N and M ( 1 ≤ NM ≤ 1000 ).

    Then there are N lines.

    In the i-th line, first is a integer k, meaning that the i-th girl has k cards.

    Then comes k integers, which are the IDs of man.

    输出

    Description

    Tzdin wants to organize a ball in the Christmas Eve. N women and M ( MN ) men intend to take part in the party. At the beginning of the party, tzdin gives each woman several cards on which the profiles of the men are presented. Then each woman can choose a man from the cards as her partner. We assume that finally with the guidance of tzdin, each woman can choose a man from her cards. Now, we want to know which men are sure to have a partner in the end, no matter how the women choose nor how tzdin guaides.

    Input

    The first line contains N and M ( 1 ≤ NM ≤ 1000 ).

    Then there are N lines.

    In the i-th line, first is a integer k, meaning that the i-th girl has k cards.

    Then comes k integers, which are the IDs of man.

    Output

    Just output the IDs of the men who are sure to have a partner in the end, each ID in one line.

    Sample Input

    2 3
    1 1
    2 2 3

    Sample Output

    1

    Source

    样例输入

    2 3
    1 1
    2 2 3

    样例输出

    1

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部