結果

問題 No.1470 Mex Sum
ユーザー face4face4
提出日時 2021-04-10 14:11:32
言語 Kotlin
(1.9.23)
結果
AC  
実行時間 572 ms / 2,000 ms
コード長 360 bytes
コンパイル時間 14,425 ms
コンパイル使用メモリ 414,432 KB
実行使用メモリ 72,520 KB
最終ジャッジ日時 2023-09-08 10:19:16
合計ジャッジ時間 41,444 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 292 ms
52,948 KB
testcase_01 AC 291 ms
52,752 KB
testcase_02 AC 403 ms
56,000 KB
testcase_03 AC 399 ms
56,216 KB
testcase_04 AC 413 ms
56,156 KB
testcase_05 AC 401 ms
56,116 KB
testcase_06 AC 415 ms
55,976 KB
testcase_07 AC 404 ms
56,016 KB
testcase_08 AC 405 ms
56,176 KB
testcase_09 AC 400 ms
56,096 KB
testcase_10 AC 403 ms
56,096 KB
testcase_11 AC 413 ms
56,084 KB
testcase_12 AC 549 ms
64,084 KB
testcase_13 AC 548 ms
63,928 KB
testcase_14 AC 556 ms
64,044 KB
testcase_15 AC 554 ms
63,948 KB
testcase_16 AC 548 ms
65,972 KB
testcase_17 AC 552 ms
66,376 KB
testcase_18 AC 561 ms
66,128 KB
testcase_19 AC 552 ms
66,144 KB
testcase_20 AC 553 ms
65,996 KB
testcase_21 AC 553 ms
64,072 KB
testcase_22 AC 554 ms
64,116 KB
testcase_23 AC 550 ms
63,816 KB
testcase_24 AC 549 ms
63,892 KB
testcase_25 AC 559 ms
64,028 KB
testcase_26 AC 558 ms
64,048 KB
testcase_27 AC 551 ms
63,940 KB
testcase_28 AC 549 ms
63,964 KB
testcase_29 AC 549 ms
63,924 KB
testcase_30 AC 552 ms
64,360 KB
testcase_31 AC 548 ms
64,188 KB
testcase_32 AC 558 ms
63,956 KB
testcase_33 AC 551 ms
64,096 KB
testcase_34 AC 554 ms
64,000 KB
testcase_35 AC 565 ms
63,976 KB
testcase_36 AC 548 ms
64,044 KB
testcase_37 AC 549 ms
72,144 KB
testcase_38 AC 541 ms
72,240 KB
testcase_39 AC 542 ms
72,288 KB
testcase_40 AC 543 ms
72,316 KB
testcase_41 AC 539 ms
72,192 KB
testcase_42 AC 538 ms
72,392 KB
testcase_43 AC 539 ms
72,196 KB
testcase_44 AC 572 ms
72,196 KB
testcase_45 AC 537 ms
72,520 KB
testcase_46 AC 541 ms
72,268 KB
testcase_47 AC 564 ms
72,256 KB
testcase_48 AC 548 ms
72,168 KB
testcase_49 AC 544 ms
72,208 KB
testcase_50 AC 565 ms
72,248 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.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++
        }.toLong()
    }.sum())
}
0