Advertisement
Void-voiD

Untitled

Apr 3rd, 2023
1,032
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.59 KB | Source Code | 0 0
  1. def func(i):
  2.     return int(i[3])
  3.  
  4.  
  5. a = open("input.txt", "r", encoding='utf-8')
  6. b = open("output.txt", "w", encoding='utf-8')
  7.  
  8. data = []
  9. for x in a.readlines():
  10.     data.append(x.split())
  11. data.sort(key=func, reverse=True)
  12.  
  13. count = 0
  14. mx1 = int(data[0][3])
  15. mx2 = 10 ** 9
  16. fn = ''
  17. ln = ''
  18.  
  19. for x in data:
  20.     score = int(x[3])
  21.     if score < mx1 and mx2 == -1:
  22.         count += 1
  23.         fn = x[0]
  24.         ln = x[1]
  25.         mx2 = score
  26.     elif score == mx2:
  27.         count += 1
  28.  
  29. if count > 1:
  30.     print(count, file=b, end='')
  31. elif count == 1:
  32.     print(fn, ln, file=b, end='')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement