Skip to content

Commit 03aaeda

Browse files
authored
Update failure_percent.py
1 parent b29f3e1 commit 03aaeda

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed
Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
def solution(N, stages):
2-
stage_score = []
3-
for i in range(N + 2):
4-
stage_score.append([i, 0, 0])
2+
# stage별 도달 참가자 수 구하기
3+
stage_score = [0] * (N + 2)
54
for stage in stages:
6-
stage_score[stage][1] += 1
5+
stage_score[stage] += 1
6+
# 각 stage별 실패율과 stage 저장하기
7+
stage_info = []
78
for i in range(1, N + 1):
8-
stage_score[stage][2] = stage_score[i][1] / sum(stage_score[i:N + 2])
9-
print(stage_score)
10-
answer = []
11-
return answer
9+
stage_info.append([i, stage_score[i] / sum(stage_score[i:N + 2])])
10+
# 실패율을 기준으로 내림차순으로 정리
11+
stage_info.sort(key=lambda x:-x[1])
12+
return [i[0] for i in stage_info]

0 commit comments

Comments
 (0)