結果

問題 No.1268 Fruit Rush 2
ユーザー stnkienstnkien
提出日時 2020-10-23 23:56:23
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 228 bytes
コンパイル時間 280 ms
コンパイル使用メモリ 87,284 KB
実行使用メモリ 177,344 KB
最終ジャッジ日時 2023-09-28 19:16:28
合計ジャッジ時間 8,362 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 96 ms
71,788 KB
testcase_01 AC 97 ms
71,588 KB
testcase_02 AC 100 ms
71,608 KB
testcase_03 AC 97 ms
71,472 KB
testcase_04 AC 96 ms
71,584 KB
testcase_05 AC 96 ms
71,744 KB
testcase_06 AC 96 ms
71,584 KB
testcase_07 AC 96 ms
71,736 KB
testcase_08 AC 103 ms
71,972 KB
testcase_09 AC 95 ms
71,764 KB
testcase_10 AC 97 ms
71,652 KB
testcase_11 AC 95 ms
71,544 KB
testcase_12 AC 96 ms
71,464 KB
testcase_13 AC 96 ms
71,616 KB
testcase_14 AC 96 ms
71,848 KB
testcase_15 AC 96 ms
71,752 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 230 ms
148,060 KB
testcase_27 AC 230 ms
147,864 KB
testcase_28 AC 234 ms
148,000 KB
testcase_29 AC 228 ms
148,080 KB
testcase_30 AC 230 ms
147,940 KB
testcase_31 AC 248 ms
173,152 KB
testcase_32 AC 250 ms
173,376 KB
testcase_33 AC 230 ms
177,344 KB
testcase_34 WA -
testcase_35 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict

N = int(input())
*A, = map(int, input().split())
A.sort()

S = set()
dp = defaultdict(int)
for a in A:
    if a-1 in S:
        dp[a+1] = 1 + dp[a-1]
    S.add(a)
print(sum(dp.values()) + N)
0