結果

問題 No.1470 Mex Sum
ユーザー 👑 KazunKazun
提出日時 2021-04-09 21:28:43
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 113 ms / 2,000 ms
コード長 154 bytes
コンパイル時間 387 ms
コンパイル使用メモリ 87,284 KB
実行使用メモリ 104,980 KB
最終ジャッジ日時 2023-09-07 09:54:40
合計ジャッジ時間 7,673 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,460 KB
testcase_01 AC 72 ms
71,364 KB
testcase_02 AC 79 ms
76,396 KB
testcase_03 AC 78 ms
76,160 KB
testcase_04 AC 78 ms
76,748 KB
testcase_05 AC 77 ms
76,308 KB
testcase_06 AC 78 ms
76,580 KB
testcase_07 AC 78 ms
76,272 KB
testcase_08 AC 79 ms
76,528 KB
testcase_09 AC 79 ms
76,708 KB
testcase_10 AC 76 ms
76,584 KB
testcase_11 AC 76 ms
76,488 KB
testcase_12 AC 113 ms
104,688 KB
testcase_13 AC 112 ms
104,564 KB
testcase_14 AC 112 ms
104,624 KB
testcase_15 AC 110 ms
104,588 KB
testcase_16 AC 112 ms
104,548 KB
testcase_17 AC 112 ms
104,520 KB
testcase_18 AC 111 ms
104,492 KB
testcase_19 AC 113 ms
104,548 KB
testcase_20 AC 112 ms
104,596 KB
testcase_21 AC 112 ms
104,772 KB
testcase_22 AC 113 ms
104,648 KB
testcase_23 AC 112 ms
104,840 KB
testcase_24 AC 111 ms
104,740 KB
testcase_25 AC 110 ms
104,796 KB
testcase_26 AC 113 ms
104,980 KB
testcase_27 AC 112 ms
104,700 KB
testcase_28 AC 113 ms
104,696 KB
testcase_29 AC 113 ms
104,904 KB
testcase_30 AC 113 ms
104,684 KB
testcase_31 AC 112 ms
104,956 KB
testcase_32 AC 110 ms
104,688 KB
testcase_33 AC 113 ms
104,924 KB
testcase_34 AC 111 ms
104,740 KB
testcase_35 AC 112 ms
104,584 KB
testcase_36 AC 112 ms
104,844 KB
testcase_37 AC 105 ms
103,780 KB
testcase_38 AC 106 ms
103,760 KB
testcase_39 AC 104 ms
103,656 KB
testcase_40 AC 108 ms
103,772 KB
testcase_41 AC 111 ms
103,816 KB
testcase_42 AC 108 ms
103,660 KB
testcase_43 AC 108 ms
103,804 KB
testcase_44 AC 106 ms
103,764 KB
testcase_45 AC 108 ms
103,664 KB
testcase_46 AC 106 ms
104,048 KB
testcase_47 AC 107 ms
103,768 KB
testcase_48 AC 108 ms
103,760 KB
testcase_49 AC 109 ms
103,988 KB
testcase_50 AC 107 ms
103,776 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
A=list(map(int,input().split()))

x=A.count(1)
y=A.count(2)
z=N-(x+y)

X=2*x*(x-1)//2+3*x*y+2*x*z
X+=y*(y-1)//2+y*z
X+=z*(z-1)//2

print(X)
0