1
2
3
4
5
6
7
8
|
import sys
n=int(sys.stdin.readline())
tmp=[]
for i in range(n):
a,b=map(int, sys.stdin.readline().split())
tmp.append((a,b))
tmp=sorted(tmp, key= lambda x: (x[1],x[0]))
for i in tmp: print(i[0],i[1])
|
cs |
lambda로 sort하시면됩니다
반응형
'python-algorithm' 카테고리의 다른 글
백준 2108 통계학 (0) | 2021.08.24 |
---|---|
백준 10773 제로 (0) | 2021.08.24 |
백준 10866 덱 (0) | 2021.08.24 |
백준 10845 큐 (0) | 2021.08.24 |
백준 10824 스택 (0) | 2021.08.24 |
댓글