結果
問題 |
No.1470 Mex Sum
|
ユーザー |
👑 ![]() |
提出日時 | 2021-04-09 21:25:58 |
言語 | PyPy3 (7.3.15) |
結果 |
RE
|
実行時間 | - |
コード長 | 374 bytes |
コンパイル時間 | 199 ms |
コンパイル使用メモリ | 82,176 KB |
実行使用メモリ | 104,832 KB |
最終ジャッジ日時 | 2024-06-25 04:04:06 |
合計ジャッジ時間 | 6,605 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 13 RE * 36 |
ソースコード
""" """ import sys from sys import stdin N = int(stdin.readline()) A = list(map(int,stdin.readline().split())) one = 0 two = 0 for i in A: if i == 2: two += 1 elif i == 1: one += 1 else: other += 1 ans = 0 ans += 2 * (one * (one-1)//2) ans += 3 * (one * two) ans += 1 * ( N*(N-1)//2 - one * (one-1)//2 - one * two ) print (ans)