結果

問題 No.1470 Mex Sum
ユーザー wolgnik
提出日時 2021-04-09 21:29:20
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 79 ms / 2,000 ms
コード長 268 bytes
コンパイル時間 268 ms
コンパイル使用メモリ 81,904 KB
実行使用メモリ 97,408 KB
最終ジャッジ日時 2024-06-25 04:12:11
合計ジャッジ時間 5,289 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 49
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
N = int(input())
a = list(map(int, input().split()))
one = a.count(1)
two = a.count(2)
other = N - one - two

print(two * (two - 1) // 2 + other * (other - 1) // 2 + two * other + one * (one - 1) + one * other * 2 + one * two * 3)
0