結果

問題 No.1268 Fruit Rush 2
コンテスト
ユーザー roaris
提出日時 2020-11-14 15:06:22
言語 PyPy3
(7.3.23 + ACL)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 348 ms / 2,000 ms
+ 620µs
コード長 348 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 240 ms
コンパイル使用メモリ 96,240 KB
実行使用メモリ 305,908 KB
最終ジャッジ日時 2026-08-23 14:22:58
合計ジャッジ時間 9,518 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import sys
input = sys.stdin.readline
from collections import *

N = int(input())
A = list(map(int, input().split()))
A.sort()
s = set(A)
check = A+[Ai+1 for Ai in A]
check = list(set(check))
check.sort()
dp = defaultdict(int)

for c in check:
    if c in s:
        dp[c] = 1
    
    if c-1 in s:
        dp[c] += dp[c-2]

print(sum(dp.values()))
0