結果

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

ソースコード

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 + other) * (two + other - 1) // 2 + two * other + one * (one - 1) + one * other * 2 + one * two * 3)
0