๋ฌธ์
https://www.acmicpc.net/problem/7785
ํ์ด
# ๋ฐฑ์ค 7785๋ฒ ๋ฌธ์ - ํ์ฌ์ ์๋ ์ฌ๋
n = int(input())
d = dict()
for _ in range(n):
name, status = map(str, input().split())
if status == 'enter':
d[name] = status
else:
d[name] = 'leave'
people = []
for key, value in d.items():
if value == 'enter':
people.append(key)
people.sort(reverse=True)
for name in people:
print(name)
๋์ ๋๋ฆฌ๋ฅผ ํ์ฉํ ๋ฌธ์ ํด๊ฒฐ
์ด ํ์ด๊ฐ ๋ฉ๋ชจ๋ฆฌ๊ฐ ๋ ์ ๊ฒ ์ฐ์๋ค.
'๐๏ธ Algorithm > ๐ฉ ๋ฐฑ์ค' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
๐ฉ [๋ฐฑ์ค] [Python] [Silver4] 1302๋ฒ_๋ฒ ์คํธ์ ๋ฌ (0) | 2023.04.12 |
---|---|
๐ฉ [๋ฐฑ์ค] [Python] [Gold4] 4179๋ฒ_๋ถ! (0) | 2023.04.11 |
๐ฉ [๋ฐฑ์ค] [Python] [Silver4] 11652๋ฒ_์นด๋ (0) | 2023.04.10 |
๐ฉ [๋ฐฑ์ค] [Python] [Silver5] 11004๋ฒ_K๋ฒ์งธ ์ (0) | 2023.04.09 |
๐ฉ [๋ฐฑ์ค] [Python] [Gold4] 15683๋ฒ_๊ฐ์ (0) | 2023.04.05 |