Stacking Cups
This commit is contained in:
16
cups.py
Normal file
16
cups.py
Normal 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)])
|
||||
Reference in New Issue
Block a user