結果

問題 No.1470 Mex Sum
ユーザー NatsubiSogan
提出日時 2021-04-09 21:26:52
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 87 ms / 2,000 ms
コード長 242 bytes
コンパイル時間 238 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 18,876 KB
最終ジャッジ日時 2024-06-25 04:07:28
合計ジャッジ時間 5,394 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 49
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
a = list(map(int, input().split()))
one, two = a.count(1), a.count(2)
oth = n - (one + two)
print((one * two) * 3 + (one * (one - 1) // 2 + one * oth) * 2 + (n * (n - 1) // 2 - (one * two + one * (one - 1) // 2 + one * oth)))
0