import java.io.BufferedReader
import java.io.BufferedWriter
import java.io.InputStreamReader
import java.io.OutputStreamWriter
import java.util.*
val br = BufferedReader(InputStreamReader(System.`in`))
fun main()=with(br){
val bw = BufferedWriter(OutputStreamWriter(System.out))
val q11 = PriorityQueue<Pair<Int,Int>>()
var q22 = PriorityQueue<Pair<Int, Int>> { o1, o2 ->
if (o1.first == o2.first) o1.second - o2.second
else o1.first - o2.first
}
q22.add(Pair(1,2))
q22.add(Pair(4,3))
q22.add(Pair(7,3))
q22.add(Pair(1,22))
q22.add(Pair(5,1))
println(q11)
println(q22)
while(!q22.isEmpty()){
println(q22.poll())
}
bw.flush()
bw.close()
}
'알고리즘 공부 > hashmap , 자료구조' 카테고리의 다른 글
백준 9663번 with Kotlin (0) | 2021.08.23 |
---|---|
백준 11403번 with Kotlin (0) | 2021.08.20 |
백준11286번 with Kotlin (0) | 2021.08.16 |
백준 5430번 With Kotlin (0) | 2021.08.14 |
백준 7662 with Kotlin #treemap (0) | 2021.08.12 |