Algorithm/python 백준
파이썬 백준 11650 : 좌표 정렬하기
✿(๑❛ڡ❛๑)✿
2024. 3. 18. 12:40
728x90
SMALL
문제
https://www.acmicpc.net/problem/11650
11650번: 좌표 정렬하기
첫째 줄에 점의 개수 N (1 ≤ N ≤ 100,000)이 주어진다. 둘째 줄부터 N개의 줄에는 i번점의 위치 xi와 yi가 주어진다. (-100,000 ≤ xi, yi ≤ 100,000) 좌표는 항상 정수이고, 위치가 같은 두 점은 없다.
www.acmicpc.net
풀이
간단한 정렬문제! sorted를 이용해서 풀었다.
N=int(input())
coordinate=[]
for _ in range(N):
x,y=map(int, input().split())
coordinate.append([x,y])
for x,y in sorted(coordinate):
print(f"{x} {y}")
728x90
LIST