結果

問題 No.1268 Fruit Rush 2
ユーザー mlihua09mlihua09
提出日時 2020-10-23 23:41:08
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 319 ms / 2,000 ms
コード長 242 bytes
コンパイル時間 249 ms
コンパイル使用メモリ 82,556 KB
実行使用メモリ 191,612 KB
最終ジャッジ日時 2024-07-21 13:41:02
合計ジャッジ時間 6,698 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())

from collections import defaultdict

A = list(map(int, input().split()))
A.sort()
D = defaultdict(int)

for a in A:
    D[a] += 1


ans = N

for a in A:
    
    ans += D[a - 1]
    
    D[a + 1] += D[a - 1]
    
print(ans)
0