結果

問題 No.45 回転寿司
ユーザー komkomhkomkomh
提出日時 2019-04-04 17:11:46
言語 Kotlin
(1.9.23)
結果
AC  
実行時間 365 ms / 5,000 ms
コード長 446 bytes
コンパイル時間 12,983 ms
コンパイル使用メモリ 446,736 KB
実行使用メモリ 60,612 KB
最終ジャッジ日時 2024-04-30 20:07:22
合計ジャッジ時間 26,298 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 353 ms
60,384 KB
testcase_01 AC 356 ms
60,356 KB
testcase_02 AC 361 ms
60,528 KB
testcase_03 AC 357 ms
60,516 KB
testcase_04 AC 358 ms
60,436 KB
testcase_05 AC 349 ms
60,312 KB
testcase_06 AC 363 ms
60,368 KB
testcase_07 AC 360 ms
60,380 KB
testcase_08 AC 353 ms
60,420 KB
testcase_09 AC 365 ms
60,612 KB
testcase_10 AC 353 ms
60,384 KB
testcase_11 AC 349 ms
60,228 KB
testcase_12 AC 362 ms
60,476 KB
testcase_13 AC 347 ms
60,300 KB
testcase_14 AC 341 ms
60,328 KB
testcase_15 AC 359 ms
60,348 KB
testcase_16 AC 353 ms
60,368 KB
testcase_17 AC 354 ms
60,392 KB
testcase_18 AC 348 ms
60,492 KB
testcase_19 AC 355 ms
60,400 KB
testcase_20 AC 344 ms
60,404 KB
testcase_21 AC 351 ms
60,340 KB
testcase_22 AC 347 ms
60,300 KB
testcase_23 AC 347 ms
60,268 KB
testcase_24 AC 343 ms
60,288 KB
testcase_25 AC 345 ms
60,384 KB
testcase_26 AC 363 ms
60,360 KB
testcase_27 AC 357 ms
60,368 KB
testcase_28 AC 357 ms
60,512 KB
testcase_29 AC 361 ms
60,412 KB
testcase_30 AC 355 ms
60,508 KB
testcase_31 AC 341 ms
60,352 KB
testcase_32 AC 340 ms
60,448 KB
testcase_33 AC 358 ms
60,472 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.kt:2:9: warning: variable 'N' is never used
    val N: Int = readLine()!!.toInt()
        ^

ソースコード

diff #

fun main() {
    val N: Int = readLine()!!.toInt()
    var V: IntArray = readLine()!!.split(" ").map(String::toInt).toIntArray()

    fun getPlusValue(targetIndex: Int): Int {
        return if (targetIndex < V.size) V[targetIndex] else 0
    }

    for (i in (V.size - 1 downTo 0)) {
        val plus2 = getPlusValue(i + 2)
        val plus3 = getPlusValue(i + 3)
        V[i] += if (plus2 > plus3) plus2 else plus3
    }
    println(V.max())
}
0