結果
| 問題 | No.1268 Fruit Rush 2 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-03-16 22:53:27 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 163 ms / 2,000 ms |
| コード長 | 262 bytes |
| 記録 | |
| コンパイル時間 | 128 ms |
| コンパイル使用メモリ | 85,376 KB |
| 実行使用メモリ | 174,504 KB |
| 最終ジャッジ日時 | 2026-04-12 05:28:59 |
| 合計ジャッジ時間 | 5,589 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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)