結果

問題 No.2374 ASKT Subsequences
ユーザー PNJPNJ
提出日時 2023-07-07 22:39:42
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 378 bytes
コンパイル時間 788 ms
コンパイル使用メモリ 10,920 KB
実行使用メモリ 8,984 KB
最終ジャッジ日時 2023-09-29 00:14:02
合計ジャッジ時間 21,842 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 19 ms
8,508 KB
testcase_01 AC 19 ms
8,604 KB
testcase_02 AC 19 ms
8,588 KB
testcase_03 AC 20 ms
8,472 KB
testcase_04 AC 20 ms
8,580 KB
testcase_05 WA -
testcase_06 AC 19 ms
8,584 KB
testcase_07 AC 21 ms
8,476 KB
testcase_08 WA -
testcase_09 AC 20 ms
8,616 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 518 ms
8,656 KB
testcase_26 TLE -
testcase_27 TLE -
testcase_28 WA -
testcase_29 TLE -
testcase_30 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

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