結果

問題 No.1268 Fruit Rush 2
ユーザー stnkienstnkien
提出日時 2020-10-24 04:02:22
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 254 ms / 2,000 ms
コード長 212 bytes
コンパイル時間 306 ms
コンパイル使用メモリ 87,076 KB
実行使用メモリ 180,580 KB
最終ジャッジ日時 2023-09-28 20:06:13
合計ジャッジ時間 8,197 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 95 ms
71,656 KB
testcase_01 AC 96 ms
71,744 KB
testcase_02 AC 95 ms
71,632 KB
testcase_03 AC 94 ms
71,640 KB
testcase_04 AC 95 ms
71,880 KB
testcase_05 AC 94 ms
71,444 KB
testcase_06 AC 96 ms
71,820 KB
testcase_07 AC 96 ms
71,652 KB
testcase_08 AC 96 ms
71,624 KB
testcase_09 AC 97 ms
71,944 KB
testcase_10 AC 96 ms
71,828 KB
testcase_11 AC 97 ms
71,748 KB
testcase_12 AC 99 ms
71,488 KB
testcase_13 AC 97 ms
71,764 KB
testcase_14 AC 97 ms
71,856 KB
testcase_15 AC 98 ms
71,732 KB
testcase_16 AC 220 ms
134,920 KB
testcase_17 AC 203 ms
128,416 KB
testcase_18 AC 204 ms
131,412 KB
testcase_19 AC 203 ms
130,836 KB
testcase_20 AC 201 ms
129,064 KB
testcase_21 AC 201 ms
128,524 KB
testcase_22 AC 220 ms
137,192 KB
testcase_23 AC 220 ms
134,784 KB
testcase_24 AC 202 ms
131,368 KB
testcase_25 AC 198 ms
128,644 KB
testcase_26 AC 243 ms
116,832 KB
testcase_27 AC 241 ms
116,900 KB
testcase_28 AC 252 ms
116,180 KB
testcase_29 AC 254 ms
117,008 KB
testcase_30 AC 241 ms
116,936 KB
testcase_31 AC 229 ms
132,448 KB
testcase_32 AC 229 ms
134,148 KB
testcase_33 AC 219 ms
146,344 KB
testcase_34 AC 222 ms
155,932 KB
testcase_35 AC 243 ms
180,580 KB
権限があれば一括ダウンロードができます

ソースコード

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