• [1282] A Bouquet of Flowers

  • 时间限制: 1000 ms 内存限制: 444 K
  • 问题描述
  • Mr.Cai want to send TT a bouquet of the most beautiful flowers.
    Mr.Cai have buy K bouquets of flowers from the shop.
    When Mr.Cai get the bouquet of flowers that will sorted in descending order by their beautiful value.
    And Mr.Cai want pick up H flowers from the K bouquets to make up the most beautiful bouquet flowers.
  • 输入
  • There are muti-case.
    First line contain two integers K (0 < K <= 1000) and H (0 < H <= 1000)
    Then there are K lines.
    For each lines, the first number Ni (0 < Ni <= 10000) means the bouquet of flowers contains Ni flowers.
    the following Ni numbers means the flower's beautiful value Vi (0 < Vi <= 100000).
    The H is less than the sum of all Ni.
  • 输出
  • For each case, print the most beautiful flowers's beatiful value.
  • 样例输入
  • 2 3
    3 3 2 1
    3 6 5 4
    2 4
    3 4 2 1
    3 3 2 1
    
  • 样例输出
  • 15
    11
    
  • 提示
  • 来源
  • Monkeyde17
  • 操作

显示春菜