結果

問題 No.1268 Fruit Rush 2
ユーザー stnkienstnkien
提出日時 2020-10-23 23:57:06
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 241 bytes
コンパイル時間 290 ms
コンパイル使用メモリ 86,968 KB
実行使用メモリ 178,864 KB
最終ジャッジ日時 2023-09-28 19:17:11
合計ジャッジ時間 8,503 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 98 ms
71,540 KB
testcase_01 AC 96 ms
71,552 KB
testcase_02 AC 96 ms
71,644 KB
testcase_03 AC 98 ms
71,524 KB
testcase_04 AC 97 ms
71,176 KB
testcase_05 AC 95 ms
71,664 KB
testcase_06 AC 98 ms
71,576 KB
testcase_07 AC 95 ms
71,544 KB
testcase_08 AC 95 ms
71,536 KB
testcase_09 AC 96 ms
71,620 KB
testcase_10 AC 97 ms
71,676 KB
testcase_11 AC 97 ms
71,336 KB
testcase_12 AC 95 ms
71,232 KB
testcase_13 AC 99 ms
71,676 KB
testcase_14 AC 98 ms
71,576 KB
testcase_15 AC 98 ms
71,484 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
116,996 KB
testcase_27 AC 228 ms
116,828 KB
testcase_28 AC 231 ms
115,704 KB
testcase_29 AC 226 ms
118,276 KB
testcase_30 AC 234 ms
116,796 KB
testcase_31 AC 240 ms
168,924 KB
testcase_32 AC 244 ms
172,944 KB
testcase_33 AC 227 ms
177,352 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 or a-1 in dp:
        dp[a+1] = 1 + dp[a-1]
    S.add(a)
print(sum(dp.values()) + N)
0