• [C] Counter-Strike

  • 时间限制: 1000 ms 内存限制: 65535 K
  • 问题描述
  • Do you ever remember the classic game - Counter-Strike?

    STANMASH is a team member of a CS Team.
    Today his team is against another team.
    Before the starting, STANMASH, the leader of the team, decided to analyze the Combat Effectiveness of each team member. He found that - member A can kill someone in another team; member B can kill someone in another team, etc.
    So he made a list that who can kill whom. We assume that one member only can kill one enemy in that map.

    How many enemies can they kill in maximum? (We assume that STANMASH's team is larger than or the same as another's, but they can only let the same number as the enemy team member to play this match).
  • 输入
  • This problem contains several cases.
    The first line of each case is two integers N and M (1 <= M <= N <= 500), indicate the number of STANMASH team's members and another team's members.
    Then follow N lines. The first integer of ith line Ki indicates the number of enemies that ith team member can kill (0 <= Ki <= M). Then follow Ki integers, each integer is the ID of enemy that he can kill. (1 <= ID <= M)
  • 输出
  • For each case, you should output that the maximum number of enemies that they can kill.
  • 样例输入
  • 3 3
    3 1 3 2
    1 1
    1 1
    
  • 样例输出
  • 2
    
  • 提示
  • 来源
  • XadillaX
  • 操作

显示春菜