結果

問題 No.1268 Fruit Rush 2
ユーザー Navier_BoltzmannNavier_Boltzmann
提出日時 2022-10-17 07:09:12
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 345 bytes
コンパイル時間 1,490 ms
コンパイル使用メモリ 86,712 KB
実行使用メモリ 194,004 KB
最終ジャッジ日時 2023-09-10 07:45:10
合計ジャッジ時間 12,073 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 105 ms
73,028 KB
testcase_01 AC 106 ms
72,884 KB
testcase_02 AC 108 ms
73,272 KB
testcase_03 AC 107 ms
72,976 KB
testcase_04 AC 105 ms
72,976 KB
testcase_05 AC 104 ms
73,224 KB
testcase_06 AC 104 ms
72,896 KB
testcase_07 AC 105 ms
72,748 KB
testcase_08 AC 104 ms
72,664 KB
testcase_09 AC 104 ms
73,028 KB
testcase_10 AC 103 ms
73,000 KB
testcase_11 AC 104 ms
73,032 KB
testcase_12 AC 104 ms
72,992 KB
testcase_13 AC 104 ms
72,676 KB
testcase_14 AC 104 ms
72,908 KB
testcase_15 AC 105 ms
72,796 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 WA -
testcase_32 WA -
testcase_33 AC 203 ms
141,336 KB
testcase_34 AC 208 ms
147,452 KB
testcase_35 AC 224 ms
175,800 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)


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