ํฐ์คํ ๋ฆฌ ๋ทฐ
๐ฉ๐ป๐ป ๋ฌธ์
โ๐ป ํ์ด
๐จ Go
package main
import (
"bufio"
"fmt"
"os"
"sort"
)
func main() {
var n int
reader := bufio.NewReader(os.Stdin)
fmt.Fscanln(reader, &n)
writer := bufio.NewWriter(os.Stdout)
defer writer.Flush()
var mat = make([][]int, n)
for i := 0; i < n; i++ {
mat[i] = make([]int, 2)
}
for i := 0; i < n; i++ {
fmt.Fscanln(reader, &mat[i][0], &mat[i][1])
}
sort.Slice(mat, func(i, j int) bool {
for idx := range mat[i] {
if mat[i][idx] == mat[j][idx] {
continue
}
return mat[i][idx] < mat[j][idx]
}
return false
})
for i := 0; i < n; i++ {
fmt.Fprintf(writer, "%d %d\n", mat[i][0], mat[i][1])
}
}
728x90
'dev > algorithm' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
BOJ / 1181๋ฒ / ๋จ์ด ์ ๋ ฌ [Go] (0) | 2020.07.17 |
---|---|
BOJ / 11651๋ฒ / ์ขํ ์ ๋ ฌํ๊ธฐ 2 [Go] (0) | 2020.07.14 |
BOJ / 1427๋ฒ / ์ํธ์ธ์ฌ์ด๋ [Golang] (0) | 2020.07.12 |
BOJ / 2108๋ฒ / ํต๊ณํ [Golang] (0) | 2020.06.29 |
BOJ / 10989๋ฒ / ์ ์ ๋ ฌํ๊ธฐ 3 [Golang] (0) | 2020.06.28 |
๋๊ธ
๊ธ ๋ณด๊ดํจ
์ต๊ทผ์ ๋ฌ๋ฆฐ ๋๊ธ
TAG
- ๋ถํ ์ ๋ณต
- ํ
- ํ๋ก์ด๋์์ฌ
- baekjoon
- ์๊ฐ๊ต์ฒด
- BOJ
- go
- ์๊ณ ๋ฆฌ์ฆ
- python3
- BFS
- Golang
- ballet
- Macbook pro 2012 mid 13
- ๋งฅ๋ถ
- ํด์๋งต
- ๋ฐฑ์ค
- MongoDB
- Algorithm
- ์๋ฐ
- ๋งฅ๋ถ ์ ๊ทธ๋ ์ด๋
- ๋ธ๋ฃจํธํฌ์ค
- dfs
- ๋ฐ๋
- java
- ์คํ
- dp
- AWS
- ๋ชฝ๊ณ ๋๋น
- ์ด๋ถํ์
- ๋งฅ๋ถํ๋ก
- Total
- Today
- Yesterday