結果
問題 | No.472 平均順位 |
ユーザー |
![]() |
提出日時 | 2018-06-05 11:43:58 |
言語 | Kotlin (2.1.0) |
結果 |
AC
|
実行時間 | 1,225 ms / 2,000 ms |
コード長 | 634 bytes |
コンパイル時間 | 11,635 ms |
コンパイル使用メモリ | 434,052 KB |
実行使用メモリ | 88,564 KB |
最終ジャッジ日時 | 2024-11-20 16:09:07 |
合計ジャッジ時間 | 25,169 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 16 |
コンパイルメッセージ
Main.kt:3:10: warning: parameter 'args' is never used fun main(args: Array<String>) { ^
ソースコード
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() )})val inf = 100000L*Nvar dp = Array(P+4, { inf })dp[3] = 0val dp2 = Array(P+4, { inf })for (i in 0 until N) {val _dp = dp2.clone()for (dest in Math.min(3*i+6, P+3) downTo 3) {_dp[dest] = Math.min(Math.min(Math.min(dp[dest]+q[i][0], dp[dest-1]+q[i][1]), dp[dest-2]+q[i][2]), dp[dest-3]+1)}dp = _dp}println(dp[P+3].toDouble() / N.toDouble())}