結果
問題 | No.92 逃走経路 |
ユーザー | バカらっく |
提出日時 | 2019-09-28 06:49:53 |
言語 | Kotlin (1.9.23) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,609 bytes |
コンパイル時間 | 17,098 ms |
コンパイル使用メモリ | 449,820 KB |
実行使用メモリ | 93,288 KB |
最終ジャッジ日時 | 2024-10-01 06:56:16 |
合計ジャッジ時間 | 29,953 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | AC | 332 ms
56,948 KB |
testcase_02 | AC | 328 ms
57,020 KB |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | AC | 422 ms
59,760 KB |
testcase_06 | AC | 437 ms
59,784 KB |
testcase_07 | AC | 428 ms
59,768 KB |
testcase_08 | AC | 360 ms
59,352 KB |
testcase_09 | AC | 954 ms
92,656 KB |
testcase_10 | WA | - |
testcase_11 | AC | 841 ms
92,716 KB |
testcase_12 | AC | 895 ms
92,836 KB |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
コンパイルメッセージ
Main.kt:4:10: warning: parameter 'arr' is never used fun main(arr:Array<String>) { ^ Main.kt:5:9: warning: variable 'cityCount' is never used val(cityCount, roadCount, logCount) = readLine()!!.split(" ").map { it.toInt() } ^ Main.kt:5:31: warning: variable 'logCount' is never used val(cityCount, roadCount, logCount) = readLine()!!.split(" ").map { it.toInt() } ^
ソースコード
import kotlin.math.PI fun main(arr:Array<String>) { val(cityCount, roadCount, logCount) = readLine()!!.split(" ").map { it.toInt() } val roads = mutableMapOf<Int,MutableMap<Int, MutableMap<Long, Boolean>>>() (0 until roadCount).forEach { val(city1, city2, cost) = readLine()!!.split(" ").map { it.toInt() } if(!roads.containsKey(city1)) { roads[city1] = mutableMapOf() } if(!roads.containsKey(city2)) { roads[city2] = mutableMapOf() } if(!roads[city1]!!.containsKey(city2)) { roads[city1]!![city2] = mutableMapOf() } if(!roads[city2]!!.containsKey(city1)) { roads[city2]!![city1] = mutableMapOf() } roads[city1]!![city2]!![cost.toLong()] = true roads[city2]!![city1]!![cost.toLong()] = true } val log = readLine()!!.split(" ").map { it.toLong() } val ans = Proc(roads, log).getAns() println(ans.size) println(ans.joinToString(" ")) } class Proc(val roads:Map<Int, Map<Int,Map<Long, Boolean>>>, val log:List<Long>) { public fun getAns():List<Int> { var currentList = roads.map { a->a.value.filter { b-> log[0] in b.value.keys }.map { it.key }.toMutableList() }.reduce { acc, list -> acc.union(list).toMutableList() }.toList() for(i in log.drop(1)) { currentList = currentList.map { a->roads[a]?.let { b-> b.filter { i in it.value.keys }.keys.toMutableList() }?: mutableListOf() }.reduce { acc, mutableList -> acc.union(mutableList).toMutableList() }.toList() } return currentList } }