• [J] Jewellery

  • 时间限制: 1000 ms 内存限制: 65535 K
  • 问题描述
  • One day, Anwei Zhao robbed a bank and got N jewels, each jewel had a value. Anwei Zhao took a bag to pack his jewels but the bag was not big enough so he could only pack M jewels. AnWei Zhao was greedy so he wanted to earn more, he told you he had a habit, jewels of the same value should be considered only once. Can you tell him how to pack?
  • 输入
  • Each test case consist of two lines. The first line consist two integers N and M, 1 < N <= 1000000 and M < N. The second line consist of N integers, each number is in (0, 1000000]. All data is valid so you can assume your code can print all the M numbers.
  • 输出
  • You should output M numbers in a line for each test case. Notice there is a space between these numbers.
  • 样例输入
  • 4 2
    5 5 2 1
    10 3
    3 2 1 6 5 4 9 8 7 10
  • 样例输出
  • 5 2
    10 9 8
  • 提示
  • 来源
  • 本站或者转载
  • 操作

显示春菜