結果

問題 No.1470 Mex Sum
ユーザー face4face4
提出日時 2021-04-10 14:02:15
言語 Kotlin
(1.9.23)
結果
AC  
実行時間 541 ms / 2,000 ms
コード長 392 bytes
コンパイル時間 13,356 ms
コンパイル使用メモリ 416,652 KB
実行使用メモリ 66,344 KB
最終ジャッジ日時 2023-09-08 10:07:30
合計ジャッジ時間 39,799 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 281 ms
52,924 KB
testcase_01 AC 280 ms
53,056 KB
testcase_02 AC 392 ms
55,524 KB
testcase_03 AC 413 ms
55,592 KB
testcase_04 AC 398 ms
55,536 KB
testcase_05 AC 383 ms
55,416 KB
testcase_06 AC 392 ms
55,572 KB
testcase_07 AC 393 ms
55,428 KB
testcase_08 AC 383 ms
55,388 KB
testcase_09 AC 382 ms
55,460 KB
testcase_10 AC 390 ms
55,592 KB
testcase_11 AC 386 ms
55,524 KB
testcase_12 AC 515 ms
64,120 KB
testcase_13 AC 517 ms
64,120 KB
testcase_14 AC 541 ms
63,848 KB
testcase_15 AC 516 ms
64,344 KB
testcase_16 AC 514 ms
63,792 KB
testcase_17 AC 514 ms
63,848 KB
testcase_18 AC 517 ms
64,128 KB
testcase_19 AC 527 ms
63,824 KB
testcase_20 AC 513 ms
64,104 KB
testcase_21 AC 517 ms
64,344 KB
testcase_22 AC 514 ms
63,932 KB
testcase_23 AC 524 ms
63,908 KB
testcase_24 AC 513 ms
63,848 KB
testcase_25 AC 515 ms
63,804 KB
testcase_26 AC 516 ms
63,912 KB
testcase_27 AC 515 ms
64,036 KB
testcase_28 AC 517 ms
63,916 KB
testcase_29 AC 524 ms
63,992 KB
testcase_30 AC 538 ms
64,100 KB
testcase_31 AC 514 ms
63,908 KB
testcase_32 AC 518 ms
63,992 KB
testcase_33 AC 521 ms
63,856 KB
testcase_34 AC 524 ms
63,836 KB
testcase_35 AC 517 ms
63,940 KB
testcase_36 AC 532 ms
63,888 KB
testcase_37 AC 497 ms
66,188 KB
testcase_38 AC 492 ms
66,168 KB
testcase_39 AC 493 ms
66,260 KB
testcase_40 AC 496 ms
66,176 KB
testcase_41 AC 501 ms
66,104 KB
testcase_42 AC 500 ms
66,032 KB
testcase_43 AC 495 ms
66,048 KB
testcase_44 AC 494 ms
66,100 KB
testcase_45 AC 494 ms
66,100 KB
testcase_46 AC 503 ms
66,116 KB
testcase_47 AC 497 ms
66,104 KB
testcase_48 AC 499 ms
66,344 KB
testcase_49 AC 507 ms
66,312 KB
testcase_50 AC 497 ms
66,072 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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.toInt() }
    var one = 0
    var two = 0
    var others = 0
    var answer: Long = 0
    a.forEach{
        answer += when(it){
            1 -> 2*one++ + 3*two + 2*others
            2 -> 3*one + 1*two++ + 1*others
            else -> 2*one + 1*two + 1*others++
        }
    }
    println(answer)
}
0