結果
問題 |
No.1268 Fruit Rush 2
|
ユーザー |
|
提出日時 | 2022-10-17 07:20:17 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 327 ms / 2,000 ms |
コード長 | 384 bytes |
コンパイル時間 | 175 ms |
コンパイル使用メモリ | 82,560 KB |
実行使用メモリ | 201,344 KB |
最終ジャッジ日時 | 2024-06-27 23:23:21 |
合計ジャッジ時間 | 7,160 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 33 |
ソースコード
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() s = set(A) for a in A: if a+1 in s: dp[a+1] += 1 dp[a] += dp[a-2] ans = N for a in A: ans += dp[a] print(ans)