Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from collections import OrderedDict
- N = int(input())
- data = {}
- for i in range(N):
- s = input().split()
- if (s[0] + " " + s[1] + " " + s[2]) not in data.keys():
- data[s[0] + " " + s[1] + " " + s[2]] = int(s[3])
- data = OrderedDict(sorted(data.items(), key=lambda x: x[1], reverse=True))
- max_value1 = -1
- max_value2 = -1
- res_key = ""
- for key, value in data.items():
- if value >= max_value1:
- max_value1 = value
- elif value > max_value2:
- max_value2 = value
- res_key = key
- k = 0
- for i in data:
- if data[i] == max_value2:
- k += 1
- print(res_key, max_value2) if k == 1 else print(k)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement