Advertisement
Guest User

Untitled

a guest
May 25th, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.93 KB | None | 0 0
  1. n = int(input())
  2. max_score = max2_score = 0
  3. max_name = max2_name = ''
  4. count = 0
  5. count2 = 0
  6. for i in range(n):
  7.     last_name, first_name, school, score = input().split()
  8.     name = last_name + ' ' + first_name
  9.     school, score = int(school), int(score)
  10.     if school == 50:
  11.         if score > max_score:
  12.             max2_score = max_score
  13.             max2_name = max_name
  14.             count2 = count
  15.             max_score = score
  16.             max_name = name
  17.             count = 1
  18.         elif score == max_score:
  19.             max2_name = name
  20.             max2_score = score
  21.             count += 1
  22.         elif score > max2_score:
  23.             max2_score = score
  24.             max2_name = name
  25.             count2 = 1
  26.         elif score == max2_score:
  27.             count2 += 1
  28. if count > 2:
  29.     print(count)
  30. elif count == 2 or count == 1 and count2 == 1:
  31.     print(max_name)
  32.     print(max2_name)
  33. else:
  34.     print(max_name)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement