結果

問題 No.1470 Mex Sum
ユーザー raven7959raven7959
提出日時 2021-10-11 15:57:48
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 112 ms / 2,000 ms
コード長 171 bytes
コンパイル時間 301 ms
コンパイル使用メモリ 86,820 KB
実行使用メモリ 105,044 KB
最終ジャッジ日時 2023-10-13 21:02:30
合計ジャッジ時間 11,087 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,384 KB
testcase_01 AC 71 ms
71,548 KB
testcase_02 AC 77 ms
76,500 KB
testcase_03 AC 77 ms
76,396 KB
testcase_04 AC 78 ms
76,644 KB
testcase_05 AC 78 ms
76,344 KB
testcase_06 AC 78 ms
76,716 KB
testcase_07 AC 77 ms
76,412 KB
testcase_08 AC 77 ms
76,672 KB
testcase_09 AC 78 ms
76,688 KB
testcase_10 AC 77 ms
76,692 KB
testcase_11 AC 77 ms
76,424 KB
testcase_12 AC 112 ms
104,704 KB
testcase_13 AC 109 ms
104,684 KB
testcase_14 AC 109 ms
104,592 KB
testcase_15 AC 110 ms
104,760 KB
testcase_16 AC 109 ms
104,640 KB
testcase_17 AC 108 ms
104,660 KB
testcase_18 AC 111 ms
104,656 KB
testcase_19 AC 110 ms
104,724 KB
testcase_20 AC 111 ms
104,636 KB
testcase_21 AC 111 ms
104,808 KB
testcase_22 AC 111 ms
104,764 KB
testcase_23 AC 109 ms
104,788 KB
testcase_24 AC 109 ms
104,856 KB
testcase_25 AC 110 ms
104,856 KB
testcase_26 AC 110 ms
104,736 KB
testcase_27 AC 109 ms
104,788 KB
testcase_28 AC 109 ms
104,744 KB
testcase_29 AC 110 ms
104,716 KB
testcase_30 AC 109 ms
104,796 KB
testcase_31 AC 108 ms
105,036 KB
testcase_32 AC 111 ms
105,044 KB
testcase_33 AC 109 ms
104,812 KB
testcase_34 AC 112 ms
104,828 KB
testcase_35 AC 111 ms
104,676 KB
testcase_36 AC 112 ms
104,864 KB
testcase_37 AC 106 ms
103,816 KB
testcase_38 AC 105 ms
103,900 KB
testcase_39 AC 105 ms
103,952 KB
testcase_40 AC 112 ms
103,856 KB
testcase_41 AC 106 ms
103,948 KB
testcase_42 AC 107 ms
103,804 KB
testcase_43 AC 107 ms
103,792 KB
testcase_44 AC 107 ms
103,860 KB
testcase_45 AC 107 ms
103,884 KB
testcase_46 AC 106 ms
103,896 KB
testcase_47 AC 106 ms
103,772 KB
testcase_48 AC 108 ms
103,804 KB
testcase_49 AC 107 ms
103,952 KB
testcase_50 AC 107 ms
103,840 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
A=list(map(int,input().split()))
cnt1=A.count(1)
cnt2=A.count(2)
ans=0
ans+=cnt1*(cnt1-1)+3*cnt1*cnt2+2*cnt1*(N-cnt1-cnt2)+(N-cnt1)*(N-cnt1-1)//2
print(ans)
0