๐Ÿ—๏ธ Algorithm/๐ŸŸฉ ๋ฐฑ์ค€

[๋ฐฑ์ค€] [Python] 11651๋ฒˆ_๋‚˜์ด์ˆœ ์ •๋ ฌ

Dbswnstjd 2022. 3. 14. 13:09

https://www.acmicpc.net/problem/11651

 

11651๋ฒˆ: ์ขŒํ‘œ ์ •๋ ฌํ•˜๊ธฐ 2

์ฒซ์งธ ์ค„์— ์ ์˜ ๊ฐœ์ˆ˜ N (1 ≤ N ≤ 100,000)์ด ์ฃผ์–ด์ง„๋‹ค. ๋‘˜์งธ ์ค„๋ถ€ํ„ฐ N๊ฐœ์˜ ์ค„์—๋Š” i๋ฒˆ์ ์˜ ์œ„์น˜ xi์™€ yi๊ฐ€ ์ฃผ์–ด์ง„๋‹ค. (-100,000 ≤ xi, yi ≤ 100,000) ์ขŒํ‘œ๋Š” ํ•ญ์ƒ ์ •์ˆ˜์ด๊ณ , ์œ„์น˜๊ฐ€ ๊ฐ™์€ ๋‘ ์ ์€ ์—†๋‹ค.

www.acmicpc.net

ํ’€์ด

# ๋ฐฑ์ค€ 11651๋ฒˆ ๋ฌธ์ œ - ์ขŒํ‘œ ์ •๋ ฌํ•˜๊ธฐ 2
n = int(input())
coord = []
for _ in range(n):
    x, y = map(int, input().split())
    coord.append([x,y])
coord.sort(key = lambda x: (x[1], x[0]))
for i in coord:
    print(i[0] ,i[1])