結果

問題 No.1268 Fruit Rush 2
ユーザー roarisroaris
提出日時 2020-11-14 15:06:22
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 498 ms / 2,000 ms
コード長 348 bytes
コンパイル時間 1,015 ms
コンパイル使用メモリ 86,544 KB
実行使用メモリ 258,276 KB
最終ジャッジ日時 2023-09-30 04:59:32
合計ジャッジ時間 11,130 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 100 ms
71,712 KB
testcase_01 AC 98 ms
71,464 KB
testcase_02 AC 100 ms
71,512 KB
testcase_03 AC 101 ms
71,640 KB
testcase_04 AC 99 ms
71,680 KB
testcase_05 AC 100 ms
71,592 KB
testcase_06 AC 99 ms
71,552 KB
testcase_07 AC 102 ms
71,520 KB
testcase_08 AC 101 ms
71,556 KB
testcase_09 AC 100 ms
71,680 KB
testcase_10 AC 100 ms
71,564 KB
testcase_11 AC 100 ms
71,516 KB
testcase_12 AC 102 ms
71,508 KB
testcase_13 AC 98 ms
71,660 KB
testcase_14 AC 97 ms
71,780 KB
testcase_15 AC 98 ms
71,404 KB
testcase_16 AC 273 ms
195,004 KB
testcase_17 AC 253 ms
185,316 KB
testcase_18 AC 252 ms
186,432 KB
testcase_19 AC 251 ms
185,828 KB
testcase_20 AC 252 ms
186,080 KB
testcase_21 AC 248 ms
185,500 KB
testcase_22 AC 261 ms
195,168 KB
testcase_23 AC 262 ms
195,000 KB
testcase_24 AC 252 ms
186,188 KB
testcase_25 AC 252 ms
185,496 KB
testcase_26 AC 498 ms
220,192 KB
testcase_27 AC 481 ms
219,956 KB
testcase_28 AC 485 ms
220,512 KB
testcase_29 AC 478 ms
220,784 KB
testcase_30 AC 474 ms
219,968 KB
testcase_31 AC 277 ms
211,568 KB
testcase_32 AC 276 ms
211,320 KB
testcase_33 AC 265 ms
209,556 KB
testcase_34 AC 328 ms
258,276 KB
testcase_35 AC 347 ms
257,692 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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