結果

問題 No.2196 Pair Bonus
コンテスト
ユーザー バカらっく
提出日時 2023-01-26 02:02:01
言語 Kotlin
(2.3.10)
コンパイル:
kotlinc _filename_ -include-runtime -d main.jar
実行:
kotlin main.jar
結果
AC  
実行時間 752 ms / 2,000 ms
コード長 628 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 10,341 ms
コンパイル使用メモリ 463,656 KB
実行使用メモリ 120,384 KB
最終ジャッジ日時 2026-03-14 04:38:37
合計ジャッジ時間 18,824 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 15
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

fun main(args: Array<String>) {
    println(getAns())
}

fun getAns():Long {
    val n = readLine()!!.toInt()
    val a = readLine()!!.split(" ").map { it.toLong() }
    val b = readLine()!!.split(" ").map { it.toLong() }
    val x = readLine()!!.split(" ").map { it.toLong() }
    val y = readLine()!!.split(" ").map { it.toLong() }

    var ans = 0L
    for(i in 0 until n) {
        var total = a[i*2] + a[i*2+1] + x[i]
        total = Math.max(total, a[i*2]+b[i*2+1]+y[i])
        total = Math.max(total, b[i*2]+a[i*2+1]+y[i])
        total = Math.max(total, b[i*2]+b[i*2+1]+x[i])
        ans += total
    }
    return ans
}
0