結果
| 問題 |
No.1268 Fruit Rush 2
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-03-16 22:53:27 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 227 ms / 2,000 ms |
| コード長 | 262 bytes |
| コンパイル時間 | 298 ms |
| コンパイル使用メモリ | 82,280 KB |
| 実行使用メモリ | 171,348 KB |
| 最終ジャッジ日時 | 2024-09-25 01:53:30 |
| 合計ジャッジ時間 | 6,867 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 33 |
ソースコード
N = int(input())
A = list(map(int,input().split()))
A.sort()
from collections import defaultdict
d = defaultdict(int)
for a in A:
d[a] += 1
for a in reversed(A):
if a - 2 in d:
d[a-2] += d[a]
ans = 0
for a in A:
ans += 1 + d[a+1]
print(ans)