結果

問題 No.1470 Mex Sum
ユーザー face4face4
提出日時 2021-04-10 14:08:08
言語 Kotlin
(1.9.23)
結果
AC  
実行時間 554 ms / 2,000 ms
コード長 354 bytes
コンパイル時間 13,448 ms
コンパイル使用メモリ 415,252 KB
実行使用メモリ 72,844 KB
最終ジャッジ日時 2023-09-08 10:15:29
合計ジャッジ時間 39,750 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 283 ms
53,320 KB
testcase_01 AC 280 ms
53,380 KB
testcase_02 AC 394 ms
56,172 KB
testcase_03 AC 392 ms
56,292 KB
testcase_04 AC 390 ms
56,144 KB
testcase_05 AC 391 ms
56,188 KB
testcase_06 AC 395 ms
56,188 KB
testcase_07 AC 390 ms
56,164 KB
testcase_08 AC 398 ms
56,248 KB
testcase_09 AC 414 ms
56,196 KB
testcase_10 AC 406 ms
56,192 KB
testcase_11 AC 408 ms
56,332 KB
testcase_12 AC 548 ms
64,180 KB
testcase_13 AC 532 ms
64,184 KB
testcase_14 AC 541 ms
64,120 KB
testcase_15 AC 538 ms
64,284 KB
testcase_16 AC 540 ms
66,188 KB
testcase_17 AC 542 ms
66,140 KB
testcase_18 AC 535 ms
66,148 KB
testcase_19 AC 547 ms
66,528 KB
testcase_20 AC 540 ms
66,168 KB
testcase_21 AC 539 ms
64,136 KB
testcase_22 AC 540 ms
64,108 KB
testcase_23 AC 539 ms
64,460 KB
testcase_24 AC 540 ms
64,128 KB
testcase_25 AC 538 ms
64,204 KB
testcase_26 AC 536 ms
64,180 KB
testcase_27 AC 545 ms
64,152 KB
testcase_28 AC 540 ms
64,212 KB
testcase_29 AC 540 ms
64,540 KB
testcase_30 AC 539 ms
64,184 KB
testcase_31 AC 554 ms
64,292 KB
testcase_32 AC 541 ms
64,100 KB
testcase_33 AC 539 ms
64,220 KB
testcase_34 AC 547 ms
64,124 KB
testcase_35 AC 538 ms
64,120 KB
testcase_36 AC 543 ms
64,096 KB
testcase_37 AC 529 ms
72,336 KB
testcase_38 AC 528 ms
72,844 KB
testcase_39 AC 529 ms
72,452 KB
testcase_40 AC 548 ms
72,344 KB
testcase_41 AC 540 ms
72,316 KB
testcase_42 AC 532 ms
72,356 KB
testcase_43 AC 549 ms
72,316 KB
testcase_44 AC 536 ms
72,568 KB
testcase_45 AC 548 ms
72,476 KB
testcase_46 AC 537 ms
72,408 KB
testcase_47 AC 546 ms
72,416 KB
testcase_48 AC 546 ms
72,364 KB
testcase_49 AC 530 ms
72,356 KB
testcase_50 AC 531 ms
72,340 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 -> 2L*one++ + 3*two + 2*others
            2L -> 3L*one + 1*two++ + 1*others
            else -> 2L*one + 1*two + 1*others++
        }
    }.sum())
}
0