結果

問題 No.1470 Mex Sum
ユーザー rodearodea
提出日時 2021-04-11 12:47:05
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 114 ms / 2,000 ms
コード長 340 bytes
コンパイル時間 392 ms
コンパイル使用メモリ 87,048 KB
実行使用メモリ 105,472 KB
最終ジャッジ日時 2023-09-09 15:19:10
合計ジャッジ時間 9,795 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,140 KB
testcase_01 AC 69 ms
71,508 KB
testcase_02 AC 77 ms
77,040 KB
testcase_03 AC 79 ms
76,956 KB
testcase_04 AC 79 ms
77,436 KB
testcase_05 AC 78 ms
76,724 KB
testcase_06 AC 78 ms
77,192 KB
testcase_07 AC 78 ms
76,992 KB
testcase_08 AC 80 ms
77,224 KB
testcase_09 AC 80 ms
77,216 KB
testcase_10 AC 78 ms
77,196 KB
testcase_11 AC 80 ms
76,960 KB
testcase_12 AC 113 ms
105,168 KB
testcase_13 AC 113 ms
105,336 KB
testcase_14 AC 113 ms
105,452 KB
testcase_15 AC 112 ms
105,352 KB
testcase_16 AC 111 ms
105,020 KB
testcase_17 AC 112 ms
105,200 KB
testcase_18 AC 111 ms
105,264 KB
testcase_19 AC 114 ms
105,120 KB
testcase_20 AC 113 ms
104,980 KB
testcase_21 AC 112 ms
105,216 KB
testcase_22 AC 112 ms
105,312 KB
testcase_23 AC 114 ms
105,472 KB
testcase_24 AC 111 ms
105,184 KB
testcase_25 AC 113 ms
105,296 KB
testcase_26 AC 112 ms
105,360 KB
testcase_27 AC 113 ms
105,428 KB
testcase_28 AC 111 ms
105,216 KB
testcase_29 AC 112 ms
105,144 KB
testcase_30 AC 114 ms
105,472 KB
testcase_31 AC 111 ms
105,240 KB
testcase_32 AC 111 ms
105,304 KB
testcase_33 AC 111 ms
105,212 KB
testcase_34 AC 111 ms
105,468 KB
testcase_35 AC 111 ms
105,444 KB
testcase_36 AC 111 ms
105,300 KB
testcase_37 AC 103 ms
104,060 KB
testcase_38 AC 102 ms
104,164 KB
testcase_39 AC 102 ms
103,980 KB
testcase_40 AC 107 ms
104,616 KB
testcase_41 AC 111 ms
104,292 KB
testcase_42 AC 105 ms
104,452 KB
testcase_43 AC 106 ms
104,440 KB
testcase_44 AC 105 ms
104,432 KB
testcase_45 AC 105 ms
104,456 KB
testcase_46 AC 106 ms
104,492 KB
testcase_47 AC 106 ms
104,608 KB
testcase_48 AC 105 ms
104,340 KB
testcase_49 AC 111 ms
104,204 KB
testcase_50 AC 105 ms
104,520 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
a = list(map(int, input().split()))

cnt = [0] * 3
for i in a:
    if i == 1:
        cnt[0] += 1
    elif i == 2:
        cnt[1] += 1
    else:
        cnt[2] += 1

print(cnt[0] * (cnt[0] - 1) // 2 * 2 + cnt[0] * cnt[1] * 3 + cnt[0] * cnt[2] * 2 + cnt[1] * (cnt[1] - 1) // 2 + cnt[1] * cnt[2] + cnt[2] * (cnt[2] - 1) // 2)
0