結果

問題 No.2055 12x34...
ユーザー ああああ
提出日時 2022-12-28 16:09:13
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 220 bytes
コンパイル時間 284 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 529,588 KB
最終ジャッジ日時 2024-11-23 17:16:01
合計ジャッジ時間 12,100 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 5 WA * 31 RE * 4 MLE * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict
N=int(input())
A=list(map(int,input().split()))
d=defaultdict(int)
cnt=defaultdict(int)
for i in range(N):
    cnt[A[i]]+=1
    d[A[i]]+=d[A[i]-1]+cnt[A[i]-1]

print(sum(d.values()))

0