ํฐ์คํ ๋ฆฌ ๋ทฐ
๐ฉ๐ป๐ป ๋ฌธ์
โ๐ป ํ์ด
๐จ 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
- BFS
- ๋งฅ๋ถ
- python3
- ํ๋ก์ด๋์์ฌ
- BOJ
- Algorithm
- ๋ฐ๋
- ์คํ
- dp
- ๋ถํ ์ ๋ณต
- AWS
- ๋ธ๋ฃจํธํฌ์ค
- Macbook pro 2012 mid 13
- ์๊ฐ๊ต์ฒด
- ๋งฅ๋ถํ๋ก
- baekjoon
- go
- dfs
- ballet
- ์ด๋ถํ์
- ๋ฐฑ์ค
- ๋ชฝ๊ณ ๋๋น
- ์๋ฐ
- ๋งฅ๋ถ ์ ๊ทธ๋ ์ด๋
- Golang
- MongoDB
- ์๊ณ ๋ฆฌ์ฆ
- java
- ํด์๋งต
- ํ
- Total
- Today
- Yesterday