結果

問題 No.1470 Mex Sum
ユーザー raven7959
提出日時 2021-10-11 15:57:48
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 78 ms / 2,000 ms
コード長 171 bytes
コンパイル時間 183 ms
コンパイル使用メモリ 81,968 KB
実行使用メモリ 99,216 KB
最終ジャッジ日時 2024-09-15 16:31:59
合計ジャッジ時間 6,612 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 49
権限があれば一括ダウンロードができます

ソースコード

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