結果

問題 No.2374 ASKT Subsequences
ユーザー miya145592miya145592
提出日時 2023-07-07 23:08:51
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 751 bytes
コンパイル時間 292 ms
コンパイル使用メモリ 86,792 KB
実行使用メモリ 87,292 KB
最終ジャッジ日時 2023-09-29 00:52:19
合計ジャッジ時間 6,629 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
78,412 KB
testcase_01 AC 75 ms
71,224 KB
testcase_02 AC 76 ms
71,120 KB
testcase_03 AC 80 ms
71,432 KB
testcase_04 AC 76 ms
71,364 KB
testcase_05 AC 78 ms
71,300 KB
testcase_06 AC 76 ms
71,020 KB
testcase_07 AC 76 ms
71,116 KB
testcase_08 AC 77 ms
71,152 KB
testcase_09 AC 76 ms
71,260 KB
testcase_10 AC 76 ms
71,140 KB
testcase_11 AC 85 ms
75,772 KB
testcase_12 AC 80 ms
71,116 KB
testcase_13 AC 77 ms
71,396 KB
testcase_14 AC 90 ms
75,932 KB
testcase_15 AC 90 ms
75,712 KB
testcase_16 AC 88 ms
75,732 KB
testcase_17 AC 89 ms
75,592 KB
testcase_18 AC 91 ms
75,896 KB
testcase_19 AC 93 ms
75,812 KB
testcase_20 AC 95 ms
76,440 KB
testcase_21 AC 101 ms
76,832 KB
testcase_22 AC 95 ms
76,440 KB
testcase_23 AC 93 ms
75,720 KB
testcase_24 AC 94 ms
75,912 KB
testcase_25 TLE -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import bisect
import itertools

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

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

ans = 0
a1a3 = []
for a1 in D.keys():
    a3 = a1+10
    if a3 not in D:
        continue
    for i1 in D[a1]:
        for i3 in D[a3]:
            if i1+2<=i3:
                a1a3.append((i1, i3))

a2a4 = []
for a2 in D.keys():
    a4 = a2+1
    if a4 not in D:
        continue
    for i2 in D[a2]:
        for i4 in D[a4]:
            if i2+2<=i4:
                a2a4.append((i2, i4))

for i1, i3 in a1a3:
    for i2, i4 in a2a4:
        k = A[i2]-A[i1]-10
        if k<=0:
            continue
        if i1<i2<i3<i4:
            ans+=1

print(ans)
0