結果

問題 No.1268 Fruit Rush 2
ユーザー stnkien
提出日時 2020-10-24 04:02:22
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 204 ms / 2,000 ms
コード長 212 bytes
コンパイル時間 261 ms
コンパイル使用メモリ 81,988 KB
実行使用メモリ 177,132 KB
最終ジャッジ日時 2024-07-21 14:53:37
合計ジャッジ時間 5,907 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict
N = int(input())
*A, = map(int, input().split())
A.sort()
dp = defaultdict(int)
for a in A:
    dp[a] += 1
    if a-1 in dp:
        dp[a+1] += dp[a-1]
print(sum(dp.values()))
0