개발자 톡

연습문제 톡 [HSAT 5회 정기 코딩 인증평가 기출] 성적 평가

Challenge Practice Level3 성적 평가 시간초과 질문

등록일
2023-01-06 16:32:00
조회수
870
작성자
gaeun1884

import sys

n = int(sys.stdin.readline())

total_score = [0 for _ in range(n)]

for _ in range(3):
    scores = list(map(int, sys.stdin.readline().split()))
    rank = [0 for _ in range(n)]

    for i in range(len(scores)):
        # cnt = 0
        cnt = len(list(filter(lambda  num: num > scores[i], scores)))
        rank[i] = cnt+1
        total_score[i] += scores[i]
        print(rank[i], end=" ")
    print()

for i in range(len(total_score)):
    cnt = len(list(filter(lambda num: num > total_score[i], total_score)))
    print(cnt+1, end = " ")


위 코드에서 시간 초과가 계속 뜨는데 어느 부분을 더 줄일 수 있는지 모르겠습니다 ㅠㅠ

혹시 다른 아이디어가 있을까요 ?

#[hsat_5회_정기_코딩_인증평가_기출]_성적_평가
#python

이 카테고리의 톡 더보기