BOJ - 7785 - 회사에 있는 사람

Updated:

import sys

def solution():
    N = int(input())
    Company = {}

    for i in range(N):
        A, B = map(str, sys.stdin.readline().split())
        if B == "enter":
            Company[A] = True

        elif B == "leave":
            del Company[A]
    print("\n".join(sorted(Company.keys(), reverse=True)))

solution()

https://www.acmicpc.net/problem/7785

Categories:

Updated:

Leave a comment