結果

問題 No.1470 Mex Sum
ユーザー wolgnik
提出日時 2021-04-09 21:26:16
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 241 bytes
コンパイル時間 447 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 97,152 KB
最終ジャッジ日時 2024-06-25 04:04:54
合計ジャッジ時間 5,770 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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 * two * 3)
0