結果
| 問題 |
No.1268 Fruit Rush 2
|
| コンテスト | |
| ユーザー |
brthyyjp
|
| 提出日時 | 2022-02-04 14:43:54 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 419 ms / 2,000 ms |
| コード長 | 376 bytes |
| コンパイル時間 | 326 ms |
| コンパイル使用メモリ | 82,304 KB |
| 実行使用メモリ | 265,356 KB |
| 最終ジャッジ日時 | 2024-06-11 10:11:49 |
| 合計ジャッジ時間 | 8,699 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 33 |
ソースコード
n = int(input())
A = list(map(int, input().split()))
A.sort()
from collections import defaultdict
B = set()
for a in A:
B.add(a)
B.add(a+1)
B = list(B)
B.sort()
A = set(A)
dp = defaultdict(lambda: 0)
for b in B:
if b in A:
dp[b] = 1
if b-1 in A:
if b-2 >= 0:
dp[b] += dp[b-2]
ans = 0
for k, v in dp.items():
ans += v
print(ans)
brthyyjp