結果
問題 |
No.1268 Fruit Rush 2
|
ユーザー |
|
提出日時 | 2022-10-17 07:11:51 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 353 bytes |
コンパイル時間 | 144 ms |
コンパイル使用メモリ | 82,096 KB |
実行使用メモリ | 195,600 KB |
最終ジャッジ日時 | 2024-06-27 23:17:39 |
合計ジャッジ時間 | 6,314 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 WA * 1 |
other | AC * 18 WA * 15 |
ソースコード
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)