結果

問題 No.2374 ASKT Subsequences
ユーザー ikomaikoma
提出日時 2023-07-07 21:58:37
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 484 bytes
コンパイル時間 282 ms
コンパイル使用メモリ 87,180 KB
実行使用メモリ 79,000 KB
最終ジャッジ日時 2023-09-28 23:11:11
合計ジャッジ時間 6,686 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 95 ms
71,576 KB
testcase_01 AC 94 ms
71,564 KB
testcase_02 AC 95 ms
71,408 KB
testcase_03 AC 92 ms
71,372 KB
testcase_04 WA -
testcase_05 AC 98 ms
71,404 KB
testcase_06 AC 98 ms
71,548 KB
testcase_07 AC 104 ms
76,924 KB
testcase_08 AC 98 ms
71,464 KB
testcase_09 AC 106 ms
77,500 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 143 ms
77,588 KB
testcase_26 WA -
testcase_27 AC 221 ms
78,240 KB
testcase_28 WA -
testcase_29 AC 227 ms
78,944 KB
testcase_30 AC 234 ms
78,476 KB
権限があれば一括ダウンロードができます

ソースコード

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
        if k<1:continue
        a1 = a2-10-k
        a4 = a3+k+1
        ans += cntb[a1] * cnt2[a4]
    cntb[a2]+=1
print(ans)
0