結果

問題 No.2196 Pair Bonus
ユーザー バカらっくバカらっく
提出日時 2023-01-26 02:02:01
言語 Kotlin
(2.1.0)
結果
AC  
実行時間 1,069 ms / 2,000 ms
コード長 628 bytes
コンパイル時間 13,430 ms
コンパイル使用メモリ 440,036 KB
実行使用メモリ 120,628 KB
最終ジャッジ日時 2024-06-27 02:13:40
合計ジャッジ時間 26,210 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 15
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.kt:1:10: warning: parameter 'args' is never used
fun main(args: Array<String>) {
         ^

ソースコード

diff #

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