Stacking Cups

This commit is contained in:
2023-07-16 23:01:00 +02:00
parent 3dd1f0a732
commit fb8cf978a0

16
cups.py Normal file
View File

@@ -0,0 +1,16 @@
n = int(input())
cups = {}
for _ in range(n):
tokens = input().split()
try:
value = int(tokens[0]) / 2
color = tokens[1]
except ValueError:
value = int(tokens[1])
color = tokens[0]
cups[color] = value
vals = sorted(cups.values())
for val in vals:
print(list(cups.keys())[list(cups.values()).index(val)])