結果
問題 |
No.1470 Mex Sum
|
ユーザー |
![]() |
提出日時 | 2021-04-17 18:56:02 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 274 bytes |
コンパイル時間 | 189 ms |
コンパイル使用メモリ | 82,268 KB |
実行使用メモリ | 102,312 KB |
最終ジャッジ日時 | 2024-07-04 01:57:59 |
合計ジャッジ時間 | 6,741 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 14 WA * 35 |
ソースコード
N = int(input()) A = list(map(int, input().split())) cnt1 = 0 cnt2 = 0 for a in A: if a == 1: cnt1 += 1 elif a == 2: cnt2 += 1 res = (cnt1 - 1) * cnt1 // 2 * 2 + cnt1 * cnt2 * 3 + N * (N - 1) // 2 - cnt1 * cnt2 - (cnt1 - 1) * cnt1 // 2 print(res)