結果

問題 No.1470 Mex Sum
ユーザー pajannatpajannat
提出日時 2021-04-10 14:11:27
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 105 ms / 2,000 ms
コード長 277 bytes
コンパイル時間 408 ms
コンパイル使用メモリ 87,412 KB
実行使用メモリ 93,184 KB
最終ジャッジ日時 2023-09-08 10:18:04
合計ジャッジ時間 7,275 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 68 ms
71,164 KB
testcase_01 AC 69 ms
71,236 KB
testcase_02 AC 74 ms
76,304 KB
testcase_03 AC 74 ms
76,084 KB
testcase_04 AC 74 ms
76,480 KB
testcase_05 AC 75 ms
76,304 KB
testcase_06 AC 74 ms
76,784 KB
testcase_07 AC 74 ms
76,044 KB
testcase_08 AC 75 ms
76,544 KB
testcase_09 AC 77 ms
76,136 KB
testcase_10 AC 75 ms
76,128 KB
testcase_11 AC 75 ms
76,096 KB
testcase_12 AC 97 ms
92,684 KB
testcase_13 AC 97 ms
92,572 KB
testcase_14 AC 99 ms
92,972 KB
testcase_15 AC 99 ms
92,544 KB
testcase_16 AC 99 ms
92,472 KB
testcase_17 AC 96 ms
92,492 KB
testcase_18 AC 96 ms
92,488 KB
testcase_19 AC 99 ms
92,540 KB
testcase_20 AC 97 ms
92,448 KB
testcase_21 AC 97 ms
92,580 KB
testcase_22 AC 98 ms
92,644 KB
testcase_23 AC 99 ms
92,508 KB
testcase_24 AC 100 ms
92,592 KB
testcase_25 AC 97 ms
92,668 KB
testcase_26 AC 99 ms
92,944 KB
testcase_27 AC 101 ms
93,184 KB
testcase_28 AC 99 ms
92,660 KB
testcase_29 AC 97 ms
92,668 KB
testcase_30 AC 101 ms
92,888 KB
testcase_31 AC 104 ms
92,588 KB
testcase_32 AC 103 ms
92,644 KB
testcase_33 AC 103 ms
92,660 KB
testcase_34 AC 98 ms
92,668 KB
testcase_35 AC 99 ms
92,936 KB
testcase_36 AC 99 ms
92,604 KB
testcase_37 AC 95 ms
92,024 KB
testcase_38 AC 93 ms
91,808 KB
testcase_39 AC 93 ms
91,952 KB
testcase_40 AC 95 ms
91,772 KB
testcase_41 AC 95 ms
91,680 KB
testcase_42 AC 94 ms
91,608 KB
testcase_43 AC 94 ms
91,736 KB
testcase_44 AC 94 ms
91,764 KB
testcase_45 AC 95 ms
91,980 KB
testcase_46 AC 105 ms
91,732 KB
testcase_47 AC 96 ms
91,960 KB
testcase_48 AC 95 ms
91,704 KB
testcase_49 AC 95 ms
92,160 KB
testcase_50 AC 95 ms
91,820 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A = [int(i) for i in input().split()]

ONE = A.count(1)
TWO = A.count(2)
OTHER = len(A) -ONE -TWO

mex_1 = 1*(TWO*(TWO-1)/2 + OTHER*(OTHER-1)/2 +TWO*OTHER)
mex_2 = 2*(ONE*(ONE-1)/2 + ONE*OTHER) 
mex_3 = 3*(ONE*TWO)

sum = int(mex_1 + mex_2 + mex_3)

print(sum)
0