結果

問題 No.1268 Fruit Rush 2
ユーザー Navier_BoltzmannNavier_Boltzmann
提出日時 2022-10-17 07:11:51
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 353 bytes
コンパイル時間 267 ms
コンパイル使用メモリ 86,920 KB
実行使用メモリ 195,436 KB
最終ジャッジ日時 2023-09-10 07:46:47
合計ジャッジ時間 9,146 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 102 ms
73,132 KB
testcase_01 AC 100 ms
72,924 KB
testcase_02 WA -
testcase_03 AC 101 ms
72,776 KB
testcase_04 AC 100 ms
72,896 KB
testcase_05 AC 99 ms
72,896 KB
testcase_06 AC 101 ms
72,904 KB
testcase_07 AC 100 ms
72,972 KB
testcase_08 AC 98 ms
72,896 KB
testcase_09 AC 98 ms
72,864 KB
testcase_10 AC 101 ms
72,856 KB
testcase_11 AC 102 ms
72,828 KB
testcase_12 AC 102 ms
72,800 KB
testcase_13 AC 101 ms
73,004 KB
testcase_14 AC 102 ms
72,872 KB
testcase_15 AC 101 ms
72,928 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 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 214 ms
113,576 KB
testcase_32 AC 217 ms
113,236 KB
testcase_33 AC 199 ms
141,548 KB
testcase_34 AC 205 ms
147,584 KB
testcase_35 AC 219 ms
175,984 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import *
from itertools import *
from functools import *
from heapq import *
import sys,math
input = sys.stdin.readline

N = int(input())
A = list(map(int,input().split()))

dp = defaultdict(lambda:0)
A.sort()

for a in A:
    
    dp[a+1] += 1
    
    dp[a] += dp[a-2]
    
ans = N
for a in A:
    ans += dp[a]
print(ans)
    
    


0