結果

問題 No.2374 ASKT Subsequences
ユーザー miya145592miya145592
提出日時 2023-07-07 23:05:22
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 759 bytes
コンパイル時間 729 ms
コンパイル使用メモリ 87,024 KB
実行使用メモリ 77,100 KB
最終ジャッジ日時 2023-09-29 00:46:37
合計ジャッジ時間 6,730 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
76,060 KB
testcase_01 AC 73 ms
71,240 KB
testcase_02 AC 73 ms
71,420 KB
testcase_03 AC 74 ms
71,264 KB
testcase_04 AC 74 ms
71,352 KB
testcase_05 AC 75 ms
71,480 KB
testcase_06 AC 79 ms
71,408 KB
testcase_07 AC 75 ms
71,340 KB
testcase_08 AC 75 ms
71,400 KB
testcase_09 AC 76 ms
71,132 KB
testcase_10 AC 76 ms
71,392 KB
testcase_11 AC 86 ms
76,068 KB
testcase_12 AC 78 ms
71,456 KB
testcase_13 AC 77 ms
71,096 KB
testcase_14 AC 90 ms
76,180 KB
testcase_15 AC 90 ms
76,160 KB
testcase_16 AC 87 ms
76,060 KB
testcase_17 AC 91 ms
76,156 KB
testcase_18 AC 92 ms
75,988 KB
testcase_19 AC 94 ms
76,132 KB
testcase_20 AC 102 ms
77,056 KB
testcase_21 AC 104 ms
77,100 KB
testcase_22 AC 96 ms
76,644 KB
testcase_23 AC 101 ms
76,092 KB
testcase_24 AC 96 ms
76,360 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 = set()
for a1 in D.keys():
    a3 = a1+10
    if a3 not in D:
        continue
    for p in itertools.product(D[a1], D[a3]):
        if p[0]>=p[1]:
            continue
        a1a3.add(p)

a2a4 = set()
for a2 in D.keys():
    a4 = a2+1
    if a4 not in D:
        continue
    for p in itertools.product(D[a2], D[a4]):
        if p[0]>=p[1]:
            continue
        a2a4.add(p)

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