結果

問題 No.472 平均順位
ユーザー htkbhtkb
提出日時 2018-06-05 09:37:34
言語 Kotlin
(1.9.23)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 612 bytes
コンパイル時間 12,247 ms
コンパイル使用メモリ 428,688 KB
実行使用メモリ 94,260 KB
最終ジャッジ日時 2024-04-30 18:38:10
合計ジャッジ時間 30,209 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 338 ms
55,160 KB
testcase_01 AC 334 ms
55,404 KB
testcase_02 AC 332 ms
55,436 KB
testcase_03 AC 333 ms
55,152 KB
testcase_04 AC 366 ms
57,592 KB
testcase_05 AC 337 ms
55,288 KB
testcase_06 AC 350 ms
57,532 KB
testcase_07 AC 382 ms
57,484 KB
testcase_08 AC 494 ms
85,688 KB
testcase_09 AC 550 ms
87,836 KB
testcase_10 AC 607 ms
87,944 KB
testcase_11 AC 776 ms
87,864 KB
testcase_12 AC 722 ms
87,848 KB
testcase_13 AC 1,338 ms
90,156 KB
testcase_14 TLE -
testcase_15 AC 1,337 ms
90,240 KB
testcase_16 TLE -
testcase_17 TLE -
testcase_18 AC 635 ms
87,780 KB
testcase_19 AC 978 ms
88,920 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.kt:3:10: warning: parameter 'args' is never used
fun main(args: Array<String>) {
         ^

ソースコード

diff #

import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val (N, P) = Pair(sc.nextInt(), sc.nextInt())
    val q = Array(N, { arrayOf(sc.nextInt(), sc.nextInt(), sc.nextInt(), 1 )})
    var dp = Array(P+4, { 0L })
    val inf = 100000L*N
    val filled_dp = Array(P+1, { inf })
    for (i in 0 until N) {
        val _dp = filled_dp.clone()
        for (j in 0 until 4) {
            for (k in Math.min(3*i, P-j) downTo 0) {
                _dp[k+j] = Math.min(_dp[k+j], dp[k]+q[i][j])
            }
        }
        dp = _dp
    }
    println(dp[P].toDouble() / N.toDouble())
}
0