[BaekJoon] 11650번: 좌표 정렬하기 (Python)
- Reference
- 백준식 노가다..
Solution
import sys
from typing import List
def solution(array: List[List[int]]) -> List[List[int]]:
return sorted(array, key=lambda x: (x[0], x[1]))
N = int(input())
array = []
for _ in range(N):
x, y = map(int, sys.stdin.readline().split())
array.append([x, y])
# 답 출력
answer = solution(array)
for i in range(N):
print(answer[i][0], answer[i][1])
Leave a comment