結果

問題 No.1470 Mex Sum
ユーザー Eki1009Eki1009
提出日時 2021-04-09 21:24:22
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 127 ms / 2,000 ms
コード長 190 bytes
コンパイル時間 285 ms
コンパイル使用メモリ 87,316 KB
実行使用メモリ 105,904 KB
最終ジャッジ日時 2023-09-07 09:44:20
合計ジャッジ時間 7,928 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,540 KB
testcase_01 AC 72 ms
71,232 KB
testcase_02 AC 79 ms
76,212 KB
testcase_03 AC 78 ms
76,332 KB
testcase_04 AC 80 ms
76,832 KB
testcase_05 AC 79 ms
76,228 KB
testcase_06 AC 78 ms
76,564 KB
testcase_07 AC 81 ms
76,392 KB
testcase_08 AC 78 ms
76,652 KB
testcase_09 AC 79 ms
76,568 KB
testcase_10 AC 78 ms
76,768 KB
testcase_11 AC 76 ms
76,276 KB
testcase_12 AC 125 ms
105,436 KB
testcase_13 AC 125 ms
105,228 KB
testcase_14 AC 123 ms
105,540 KB
testcase_15 AC 126 ms
105,600 KB
testcase_16 AC 123 ms
105,608 KB
testcase_17 AC 123 ms
105,164 KB
testcase_18 AC 122 ms
105,452 KB
testcase_19 AC 123 ms
105,524 KB
testcase_20 AC 123 ms
105,264 KB
testcase_21 AC 127 ms
105,668 KB
testcase_22 AC 126 ms
105,516 KB
testcase_23 AC 123 ms
105,756 KB
testcase_24 AC 126 ms
105,904 KB
testcase_25 AC 125 ms
105,720 KB
testcase_26 AC 123 ms
105,636 KB
testcase_27 AC 122 ms
105,516 KB
testcase_28 AC 126 ms
105,672 KB
testcase_29 AC 124 ms
105,580 KB
testcase_30 AC 127 ms
105,348 KB
testcase_31 AC 123 ms
105,780 KB
testcase_32 AC 125 ms
105,452 KB
testcase_33 AC 126 ms
105,776 KB
testcase_34 AC 125 ms
105,852 KB
testcase_35 AC 126 ms
105,616 KB
testcase_36 AC 125 ms
105,440 KB
testcase_37 AC 104 ms
103,796 KB
testcase_38 AC 105 ms
103,796 KB
testcase_39 AC 104 ms
103,916 KB
testcase_40 AC 114 ms
104,500 KB
testcase_41 AC 113 ms
104,648 KB
testcase_42 AC 114 ms
104,624 KB
testcase_43 AC 114 ms
104,592 KB
testcase_44 AC 114 ms
104,404 KB
testcase_45 AC 114 ms
104,412 KB
testcase_46 AC 113 ms
104,636 KB
testcase_47 AC 114 ms
104,500 KB
testcase_48 AC 112 ms
104,692 KB
testcase_49 AC 111 ms
104,412 KB
testcase_50 AC 115 ms
104,616 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
A = sorted(map(int, input().split()))
x = A.count(1)
y = A.count(2)
z = n - x - y
ans = y*(y-1)//2 + y*z + z*(z-1)//2
ans += 2 * (x*(x-1)//2 + x*z)
ans += 3 * x*y
print(ans)
0