結果

問題 No.2374 ASKT Subsequences
ユーザー ikoma
提出日時 2023-07-07 21:57:43
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 460 bytes
コンパイル時間 193 ms
コンパイル使用メモリ 82,248 KB
実行使用メモリ 77,592 KB
最終ジャッジ日時 2024-07-21 17:52:16
合計ジャッジ時間 3,986 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 7 WA * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
from collections import defaultdict
N=int(input())
A=list(map(int,input().split()))
cnt = defaultdict(int)
ans=0

for a in A:
    cnt[a]+=1
cntb = defaultdict(int)

for i,a2 in enumerate(A):
    cnt[a2]-=1
    cnt2 = cnt.copy()
    for j,a3 in enumerate(A):
        cnt2[a3]-=1
        if i>=j:continue
        k=a2-a3
        a1 = a2-10-k
        a4 = a3+k+1
        ans += cntb[a1] * cnt2[a4]
    cntb[a2]+=1
print(ans)
0