結果

問題 No.1470 Mex Sum
ユーザー face4
提出日時 2021-04-10 14:06:47
言語 Kotlin
(2.1.0)
結果
WA  
実行時間 -
コード長 351 bytes
コンパイル時間 12,108 ms
コンパイル使用メモリ 430,184 KB
実行使用メモリ 80,144 KB
最終ジャッジ日時 2024-06-26 03:35:16
合計ジャッジ時間 41,932 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 10 WA * 39
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.kt:2:9: warning: variable 'n' is never used
    val n = readLine()!!.toInt()
        ^

ソースコード

diff #

fun main() {
    val n = readLine()!!.toInt()
    val a = readLine()!!.split(" ").map { it.toLong() }
    var one = 0
    var two = 0
    var others = 0
    println(a.map{
        when(it){
            1L -> 2*one++ + 3*two + 2*others
            2L -> 3*one + 1*two++ + 1*others
            else -> 2*one + 1*two + 1*others++
        }
    }.sum())
}
0