結果

問題 No.472 平均順位
ユーザー htkbhtkb
提出日時 2018-06-05 09:00:56
言語 Kotlin
(1.9.23)
結果
TLE  
実行時間 -
コード長 627 bytes
コンパイル時間 10,548 ms
コンパイル使用メモリ 433,852 KB
実行使用メモリ 96,256 KB
最終ジャッジ日時 2024-04-30 18:37:07
合計ジャッジ時間 28,864 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 330 ms
61,000 KB
testcase_01 AC 324 ms
60,968 KB
testcase_02 AC 320 ms
60,884 KB
testcase_03 AC 318 ms
61,032 KB
testcase_04 AC 369 ms
61,348 KB
testcase_05 AC 328 ms
61,012 KB
testcase_06 AC 343 ms
61,064 KB
testcase_07 AC 376 ms
63,196 KB
testcase_08 AC 476 ms
89,372 KB
testcase_09 AC 548 ms
89,292 KB
testcase_10 AC 530 ms
89,336 KB
testcase_11 AC 764 ms
89,900 KB
testcase_12 AC 697 ms
89,848 KB
testcase_13 AC 1,263 ms
91,684 KB
testcase_14 TLE -
testcase_15 AC 1,263 ms
92,692 KB
testcase_16 TLE -
testcase_17 TLE -
testcase_18 AC 595 ms
89,344 KB
testcase_19 AC 909 ms
89,764 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.kt:3:10: warning: parameter 'args' is never used
fun main(args: Array<String>) {
         ^
Main.kt:19:31: warning: unnecessary non-null assertion (!!) on a non-null receiver of type Long
    println(dp.take(P+1).min()!!.toDouble() / N.toDouble())
                              ^

ソースコード

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(4*i, P-j) downTo 0) {
                _dp[k+j] = Math.min(_dp[k+j], dp[k]+q[i][j])
            }
        }
        dp = _dp
    }
    println(dp.take(P+1).min()!!.toDouble() / N.toDouble())
}
0