結果

問題 No.2374 ASKT Subsequences
ユーザー PNJ
提出日時 2023-07-07 22:54:11
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 380 bytes
コンパイル時間 211 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 18,080 KB
最終ジャッジ日時 2024-07-21 19:10:49
合計ジャッジ時間 13,638 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 6 WA * 17 TLE * 1 -- * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict
N = int(input())
A = list(map(int,input().split()))
X = defaultdict(int)
ans = 0
for i in range(1,N-2):
  X[A[i-1]] += 1
  Y = defaultdict(int)
  for j in range(i+1,N-1):
    l = N - 2 - j + i + 1
    Y[A[l+1]] += 1
    b = A[i]
    c = A[l]
    k = b - c
    a = b - k - 10
    d = c + k + 1
    p = X[a]
    q = Y[d]
    ans += p*q
print(ans)
0