結果
問題 |
No.1470 Mex Sum
|
ユーザー |
|
提出日時 | 2021-06-01 01:27:28 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 291 bytes |
コンパイル時間 | 243 ms |
コンパイル使用メモリ | 82,176 KB |
実行使用メモリ | 102,016 KB |
最終ジャッジ日時 | 2024-11-09 00:04:20 |
合計ジャッジ時間 | 7,287 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 1 WA * 48 |
ソースコード
def mex(a,b): num = 0 if b == 2: num = b+1 else: num = 2 return num N = int(input()) A = list(map(int,input().split())) A.sort() c1 = A.count(1) ans = max(0,c1*(c1-1)) num = A[0] for i in range(c1,N): ans += (mex(num,A[i])*c1) ans += max(0,(N-c1)*(N-c1-1)) print(ans)