結果

問題 No.1470 Mex Sum
ユーザー kohei2019kohei2019
提出日時 2022-05-21 18:56:21
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 78 ms / 2,000 ms
コード長 209 bytes
コンパイル時間 225 ms
コンパイル使用メモリ 81,844 KB
実行使用メモリ 98,708 KB
最終ジャッジ日時 2023-10-20 16:32:07
合計ジャッジ時間 9,096 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
53,448 KB
testcase_01 AC 35 ms
53,448 KB
testcase_02 AC 44 ms
62,088 KB
testcase_03 AC 40 ms
62,088 KB
testcase_04 AC 41 ms
62,420 KB
testcase_05 AC 40 ms
62,088 KB
testcase_06 AC 41 ms
62,424 KB
testcase_07 AC 40 ms
62,088 KB
testcase_08 AC 40 ms
62,424 KB
testcase_09 AC 40 ms
62,424 KB
testcase_10 AC 41 ms
62,424 KB
testcase_11 AC 40 ms
62,088 KB
testcase_12 AC 74 ms
98,636 KB
testcase_13 AC 73 ms
98,576 KB
testcase_14 AC 73 ms
98,592 KB
testcase_15 AC 72 ms
98,648 KB
testcase_16 AC 73 ms
98,564 KB
testcase_17 AC 72 ms
98,524 KB
testcase_18 AC 77 ms
98,512 KB
testcase_19 AC 78 ms
98,568 KB
testcase_20 AC 73 ms
98,548 KB
testcase_21 AC 72 ms
98,676 KB
testcase_22 AC 74 ms
98,696 KB
testcase_23 AC 73 ms
98,708 KB
testcase_24 AC 73 ms
98,696 KB
testcase_25 AC 73 ms
98,696 KB
testcase_26 AC 74 ms
98,696 KB
testcase_27 AC 74 ms
98,696 KB
testcase_28 AC 74 ms
98,708 KB
testcase_29 AC 73 ms
98,696 KB
testcase_30 AC 78 ms
98,696 KB
testcase_31 AC 74 ms
98,696 KB
testcase_32 AC 74 ms
98,696 KB
testcase_33 AC 73 ms
98,696 KB
testcase_34 AC 73 ms
98,708 KB
testcase_35 AC 74 ms
98,696 KB
testcase_36 AC 74 ms
98,708 KB
testcase_37 AC 66 ms
95,724 KB
testcase_38 AC 67 ms
95,724 KB
testcase_39 AC 67 ms
95,724 KB
testcase_40 AC 70 ms
95,724 KB
testcase_41 AC 69 ms
95,724 KB
testcase_42 AC 70 ms
95,724 KB
testcase_43 AC 69 ms
95,724 KB
testcase_44 AC 70 ms
95,724 KB
testcase_45 AC 69 ms
95,724 KB
testcase_46 AC 69 ms
95,724 KB
testcase_47 AC 70 ms
95,724 KB
testcase_48 AC 70 ms
95,724 KB
testcase_49 AC 70 ms
95,724 KB
testcase_50 AC 70 ms
95,724 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
lsA = list(map(int,input().split()))
ans = 0
c1 = lsA.count(1)
c2 = lsA.count(2)
ce = N-c1-c2

v3 = c1*c2
v2 = c1*(c1-1)//2 + c1*ce
v1 = c2*(c2-1)//2 + c2*ce + ce*(ce-1)//2
print(v1+2*v2+3*v3)
0