結果

問題 No.1268 Fruit Rush 2
ユーザー brthyyjpbrthyyjp
提出日時 2022-02-04 14:43:54
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 395 ms / 2,000 ms
コード長 376 bytes
コンパイル時間 1,151 ms
コンパイル使用メモリ 86,988 KB
実行使用メモリ 259,392 KB
最終ジャッジ日時 2023-09-02 03:33:00
合計ジャッジ時間 11,227 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 84 ms
71,576 KB
testcase_01 AC 82 ms
71,480 KB
testcase_02 AC 81 ms
71,740 KB
testcase_03 AC 83 ms
71,660 KB
testcase_04 AC 84 ms
71,668 KB
testcase_05 AC 82 ms
71,672 KB
testcase_06 AC 81 ms
71,576 KB
testcase_07 AC 81 ms
71,596 KB
testcase_08 AC 83 ms
71,492 KB
testcase_09 AC 84 ms
71,704 KB
testcase_10 AC 82 ms
71,684 KB
testcase_11 AC 84 ms
71,720 KB
testcase_12 AC 83 ms
71,648 KB
testcase_13 AC 82 ms
71,752 KB
testcase_14 AC 84 ms
71,668 KB
testcase_15 AC 81 ms
71,396 KB
testcase_16 AC 249 ms
172,216 KB
testcase_17 AC 225 ms
163,028 KB
testcase_18 AC 234 ms
166,016 KB
testcase_19 AC 223 ms
163,400 KB
testcase_20 AC 224 ms
163,356 KB
testcase_21 AC 220 ms
163,340 KB
testcase_22 AC 236 ms
172,040 KB
testcase_23 AC 237 ms
172,208 KB
testcase_24 AC 226 ms
163,216 KB
testcase_25 AC 221 ms
163,324 KB
testcase_26 AC 382 ms
204,844 KB
testcase_27 AC 388 ms
204,780 KB
testcase_28 AC 395 ms
204,804 KB
testcase_29 AC 379 ms
204,700 KB
testcase_30 AC 378 ms
204,804 KB
testcase_31 AC 253 ms
181,728 KB
testcase_32 AC 249 ms
176,308 KB
testcase_33 AC 228 ms
191,536 KB
testcase_34 AC 275 ms
253,036 KB
testcase_35 AC 279 ms
259,392 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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)
0