結果

問題 No.2374 ASKT Subsequences
ユーザー ikomaikoma
提出日時 2023-07-07 21:57:43
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 460 bytes
コンパイル時間 422 ms
コンパイル使用メモリ 87,284 KB
実行使用メモリ 80,036 KB
最終ジャッジ日時 2023-09-28 23:08:49
合計ジャッジ時間 6,355 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 91 ms
71,736 KB
testcase_01 AC 93 ms
71,668 KB
testcase_02 AC 95 ms
71,668 KB
testcase_03 AC 91 ms
71,664 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 92 ms
71,712 KB
testcase_07 AC 108 ms
77,256 KB
testcase_08 WA -
testcase_09 AC 106 ms
77,720 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 153 ms
78,156 KB
testcase_26 WA -
testcase_27 AC 248 ms
78,464 KB
testcase_28 WA -
testcase_29 AC 275 ms
79,220 KB
testcase_30 WA -
権限があれば一括ダウンロードができます

ソースコード

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