BOJ - 8979 - 올림픽

Updated:

import sys

def solution():
    
    olympic = []
    N, K = map(int, sys.stdin.readline().split(' '))
    for _ in range(N):
        data = list(map(int, sys.stdin.readline().split(' ')))
        olympic.append(data)

    olympic.sort(key=lambda x : (-x[1], -x[2], -x[3]))

    idx = [olympic[i][0] for i in range(N)].index(K)

    while olympic[idx - 1][1:] == olympic[idx][1:]:
        idx -=1
        
    print(idx + 1)

solution()

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

Categories:

Updated:

Leave a comment