結果
| 問題 | No.1470 Mex Sum |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-06-01 01:27:28 |
| 言語 | PyPy3 (7.3.23 + ACL) |
| 結果 |
WA
不安定
|
| 実行時間 | - |
| コード長 | 291 bytes |
| 記録 | |
| コンパイル時間 | 70 ms |
| コンパイル使用メモリ | 80,512 KB |
| 実行使用メモリ | 104,448 KB |
| 最終ジャッジ日時 | 2026-09-21 15:03:51 |
| 合計ジャッジ時間 | 6,898 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge5_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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)