結果
問題 |
No.1470 Mex Sum
|
ユーザー |
![]() |
提出日時 | 2021-04-09 21:36:15 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 94 ms / 2,000 ms |
コード長 | 381 bytes |
コンパイル時間 | 443 ms |
コンパイル使用メモリ | 82,188 KB |
実行使用メモリ | 102,784 KB |
最終ジャッジ日時 | 2024-06-25 04:31:21 |
合計ジャッジ時間 | 6,396 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 49 |
ソースコード
n = int(input()) a = list(map(int,input().split())) c = [0]*3 for x in a: if x <= 2: c[x] += 1 ans = 0 s = n for x in a: s -= 1 if x <= 2: c[x] -= 1 if x == 1: ans += 2*(s-c[2]) ans += 3*c[2] elif x == 2: ans += 1*(s-c[1]) ans += 3*c[1] else: ans += 1*(s-c[1]) ans += 2*c[1] print(ans)