n = int(input().split())
students = []
for _ in range(n):
students.append(input().split())
students.sort(k = lambda x: (-int(x[1]), int(x[2]), -int(x[3]), x[0]))
for student in students:
print(student[0])
from itertools import combinations
# 서로 다른 인덱스에 있는 두 개의 수를 뽑아 더해서 만들 수 있는 모든 수
def solution(numbers):
return sorted(set(map(sum, combinations(numbers, 2))))
from itertools import combinations
def solution(numbers):
answer = set()
selects = list(combinations(numbers, 2))
for select in selects:
(a, b) = select
answer.add(a + b)
return sorted(answer)
기본적으로 인덱스와 원소로 이루어진 튜플(tuple)을 만들어줍니다. 따라서 인덱스와 원소를 각각 다른 변수에 할당하고 싶다면 인자 풀기(unpacking)를 해줘야 합니다.
for i, letter in enumerate(['A', 'B', 'C']):
print(i, letter)
...
0 A
1 B
2 C
def solution(citations):
citations.sort(reverse = True)
for idx, citation in enumerate(citations):
if idx >= citation:
return idx
return len(citations)
def solution(citations):
citation.sort()
for ix, citation in enumerate(citations):
if citation >= len(citations) - idx:
return len(citations) - idx
return 0