Birthday Memorization
This commit is contained in:
21
fodelsedagsmemorisering.py
Normal file
21
fodelsedagsmemorisering.py
Normal file
@@ -0,0 +1,21 @@
|
||||
n = int(input())
|
||||
|
||||
memory = {}
|
||||
names = []
|
||||
for _ in range(n):
|
||||
name, likes, birthday = input().split()
|
||||
likes = int(likes)
|
||||
|
||||
if birthday in memory.keys():
|
||||
if memory[birthday][1] < likes:
|
||||
names.remove(memory[birthday][0])
|
||||
memory[birthday] = (name, likes)
|
||||
names.append(name)
|
||||
else:
|
||||
memory[birthday] = (name, likes)
|
||||
names.append(name)
|
||||
|
||||
print(len(memory.keys()))
|
||||
names.sort()
|
||||
for name in names:
|
||||
print(name)
|
||||
Reference in New Issue
Block a user