結果

問題 No.2374 ASKT Subsequences
ユーザー miya145592miya145592
提出日時 2023-07-07 22:40:49
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 682 bytes
コンパイル時間 811 ms
コンパイル使用メモリ 87,028 KB
実行使用メモリ 78,148 KB
最終ジャッジ日時 2023-09-29 00:14:53
合計ジャッジ時間 9,981 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 83 ms
76,004 KB
testcase_01 AC 79 ms
71,124 KB
testcase_02 AC 78 ms
71,292 KB
testcase_03 AC 79 ms
71,276 KB
testcase_04 AC 78 ms
71,344 KB
testcase_05 AC 78 ms
71,228 KB
testcase_06 AC 79 ms
71,288 KB
testcase_07 AC 78 ms
71,368 KB
testcase_08 AC 79 ms
71,324 KB
testcase_09 AC 79 ms
71,396 KB
testcase_10 AC 79 ms
71,416 KB
testcase_11 AC 98 ms
76,440 KB
testcase_12 AC 89 ms
76,404 KB
testcase_13 AC 80 ms
71,364 KB
testcase_14 AC 112 ms
77,176 KB
testcase_15 AC 117 ms
77,328 KB
testcase_16 AC 101 ms
76,796 KB
testcase_17 AC 115 ms
77,004 KB
testcase_18 AC 126 ms
77,356 KB
testcase_19 AC 125 ms
77,688 KB
testcase_20 AC 131 ms
78,060 KB
testcase_21 AC 144 ms
77,872 KB
testcase_22 AC 134 ms
77,864 KB
testcase_23 AC 127 ms
78,056 KB
testcase_24 AC 129 ms
77,720 KB
testcase_25 TLE -
testcase_26 AC 182 ms
78,148 KB
testcase_27 TLE -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import bisect

N = int(input())
A = list(map(int, input().split()))

D = dict()
for i in range(1, N):
    if A[i] not in D:
        D[A[i]] = [i]
    else:
        D[A[i]].append(i)

ans = 0
for i1 in range(N):
    a1 = A[i1]
    a3 = a1+10
    if a3 not in D:
        continue
    pos = bisect.bisect_left(D[a3], i1+2)
    for j in range(pos, len(D[a3])):
        i3 = D[a3][j]
        for i2 in range(i1+1, i3):
            a2 = A[i2]
            k = a2-a1-10
            if k<=0:
                continue
            a4 = a3+k+1
            if a4 not in D:
                continue
            pos2 = bisect.bisect_left(D[a4], i3+1)
            ans += len(D[a4])-pos2

print(ans)
0