結果
問題 |
No.472 平均順位
|
ユーザー |
![]() |
提出日時 | 2018-06-05 10:39:25 |
言語 | Kotlin (2.1.0) |
結果 |
TLE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 550 bytes |
コンパイル時間 | 12,286 ms |
コンパイル使用メモリ | 434,052 KB |
実行使用メモリ | 89,496 KB |
最終ジャッジ日時 | 2024-11-20 16:08:37 |
合計ジャッジ時間 | 32,447 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 13 TLE * 3 |
コンパイルメッセージ
Main.kt:3:10: warning: parameter 'args' is never used fun main(args: Array<String>) { ^ Main.kt:11:109: warning: unnecessary non-null assertion (!!) on a non-null receiver of type Long dp[dest] = arrayOf(dp[dest]+q[i][0], dp[dest-1]+q[i][1], dp[dest-2]+q[i][2], dp[dest-3]+1).min()!! ^
ソースコード
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*N val dp = Array(P+4, { i -> if (i == 3) 0L else inf }) for (i in 0 until N) { for (dest in Math.min(3*i+6, P+3) downTo 3) { dp[dest] = arrayOf(dp[dest]+q[i][0], dp[dest-1]+q[i][1], dp[dest-2]+q[i][2], dp[dest-3]+1).min()!! } } println(dp[P+3].toDouble() / N.toDouble()) }