import Foundation
let N = Int(readLine()!)!
var tuples = [(x: Int, y: Int)]()
for _ in 1...N {
let xy = readLine()!.components(separatedBy: " ").map { Int($0)! }
let x = xy[0]
let y = xy[1]
tuples.append((x, y))
}
tuples = tuples.sorted(by: { $0.y < $1.y }).sorted(by: { $0.x < $1.x })
for tuple in tuples {
print(tuple.x, tuple.y)
}
ํํ๋ก ํ์๋ค. ์ ๋ ฌํ ๋๋ ์ ๋ ฌํ๋ ์์๋ฅผ ์ ์ํ๋๊ฒ ์ข์ ๊ฒ ๊ฐ๋ค.
๋ฐ์ํ
'๐ ์ฝํ > BOJ' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[Swift] ๋ฐฑ์ค1260 DFS์ BFS (0) | 2023.03.30 |
---|---|
[Swift] ๋ฐฑ์ค1389 ์ผ๋น ๋ฒ ์ด์ปจ์ 6๋จ๊ณ ๋ฒ์น (0) | 2023.03.30 |
[Swift] ๋ฐฑ์ค 10866 ๋ฑ (0) | 2023.03.29 |
[Swift] ๋ฐฑ์ค10845 ํ (0) | 2023.03.28 |
[Swift] ๋ฐฑ์ค9012 ๊ดํธ (0) | 2023.03.28 |