Advertisement
tungSfer

tu dien long nhau ac nghiem

Jan 16th, 2022
232
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.32 KB | None | 0 0
  1. #   TỪ ĐIỂN LỒNG NHAU
  2. n,k=map(int,input().split())
  3. if (n>70) or k>5: print("INVALID INPUT")
  4. else:
  5.     res={}
  6.     for i in range(n):
  7.         a,b=map(str,input().split())
  8.         b=int(b)
  9.         res[a]=b
  10.     ans = sorted(res.items(), key=lambda x:(-x[1],x[0]))
  11.     for i in range(k):
  12.         print(ans[i][0],end=" ")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement