結果
問題 | No.472 平均順位 |
ユーザー |
![]() |
提出日時 | 2018-06-05 17:55:46 |
言語 | Kotlin (2.1.0) |
結果 |
AC
|
実行時間 | 747 ms / 2,000 ms |
コード長 | 564 bytes |
コンパイル時間 | 13,155 ms |
コンパイル使用メモリ | 438,192 KB |
実行使用メモリ | 75,292 KB |
最終ジャッジ日時 | 2024-11-20 16:10:14 |
合計ジャッジ時間 | 21,568 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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*Nval dp = LongArray(P+4)dp.fill(inf)dp[3] = 0for (i in 0 until N) {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)}}println(dp[P+3].toDouble() / N.toDouble())}