문제 링크

풀이 과정

전체 코드

def solution(scores):
    if len(scores) == 1:    return 1
    else:
        wanho_scores = scores[0]
        wanho_total = sum(wanho_scores)
        rank = 1   # 최종 완호 순위
        scores = scores[1:]
        scores = sorted(scores, key=lambda x: (-x[0], x[1]))
        threshold = 0  
        
        for other_score in scores:
            if (wanho_scores[0] < other_score[0]) and (wanho_scores[1] < other_score[1]):     
		            return -1
            else:
                # i번째 사원의 동료 평가 점수가 (0~(i-1))번째 동료 평가 점수 이상인 경우만 고려
                if other_score[1] >= threshold:   
                    if wanho_total < sum(other_score):   rank += 1
                    threshold = other_score[1]
                    
        return rank