[BaekJoon] 11651번: 좌표 정렬하기 2 (Python)
Solution
from typing import List
def solution(coordinate: List[List[int]]) -> List[List[int]]:
return sorted(coordinate, key=lambda x: (x[1], x[0]))
N = int(input())
array = []
for _ in range(N):
xi, yi = map(int, input().split())
array.append([xi, yi])
# 답 출력
for a in solution(array):
print(*a)
Leave a comment