인접리스트3 [백준] 알고스팟 (1261)(Kotlin) 원본 문제 : https://www.acmicpc.net/problem/1261 문제 참고. : https://stack07142.tistory.com/131 다익스트라(adjacency list) import java.io.BufferedReader import java.io.InputStreamReader import java.util.* val dRow: IntArray = intArrayOf(-1,1,0,0) val dCol: IntArray = intArrayOf(0,0,-1,1) var ROW: Int = 0 var COL: Int = 0 var map: Array = arrayOf() var distance: Array = arrayOf() fun main() = with(BufferedRe.. 2020. 2. 17. [백준] 최소비용 구하기 (1916)(Kotlin) 원본 문제 : https://www.acmicpc.net/problem/1916 성공(Adjacency List) import java.io.BufferedReader import java.io.InputStreamReader import java.util.* import kotlin.collections.ArrayList class Node : Comparable { var index = 0 var distance = 0 constructor(index: Int, distance: Int) { this.index = index this.distance = distance } override fun compareTo(other: Node): Int { return this.distance - other... 2020. 2. 12. [백준] 최단경로 (1753)(Kotlin) 원본 문제 : https://www.acmicpc.net/problem/1753 실패 - 메모리초과(Adjacency Matrix) import java.io.BufferedReader import java.io.InputStreamReader fun main() = with(BufferedReader(InputStreamReader(System.`in`))){ val str = readLine().split(" ") val V = str[0].toInt() val E = str[1].toInt() val start = readLine().toInt() var graph: Array = Array( V+1 ) { IntArray( V+1 ) } for ( i in 1 until E+1 ) { val ne.. 2020. 2. 11. 이전 1 다음