BOJ - 14653 - 너의 이름은

Updated:

import sys

def solution():
    N, K, Q = map(int, sys.stdin.readline().split())

    number = [0 for _ in range(10001)]
    name = [0 for _ in range(10001)]
    check = [0 for _ in range(26)]

    for i in range(1, K+1):
        R, P = map(str, sys.stdin.readline().split())
        number[i] = int(R)
        name[i] = P

    if number[Q] == 0:
        print(-1)
        return

    for i in range(1, K+1):
        if number[Q] <= number[i]:
            check[ord(name[i]) - ord('A')] = 1

    check[0] = 1
    for i in range(N):
        if not check[i]:
            print(chr(i + 65), end=' ')

solution()

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

Categories:

Updated:

Leave a comment