結果

問題 No.2374 ASKT Subsequences
ユーザー miya145592miya145592
提出日時 2023-07-07 22:56:26
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 641 bytes
コンパイル時間 340 ms
コンパイル使用メモリ 87,152 KB
実行使用メモリ 97,248 KB
最終ジャッジ日時 2023-09-29 00:32:49
合計ジャッジ時間 6,767 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
71,736 KB
testcase_01 AC 76 ms
71,392 KB
testcase_02 AC 77 ms
71,140 KB
testcase_03 AC 82 ms
71,492 KB
testcase_04 AC 78 ms
71,652 KB
testcase_05 WA -
testcase_06 AC 80 ms
71,356 KB
testcase_07 AC 82 ms
71,388 KB
testcase_08 WA -
testcase_09 AC 77 ms
71,392 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 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 i1 in range(N-3):
    a1 = A[i1]
    a3 = a1+10
    if a3 not in D:
        continue
    for p in itertools.product([i1], D[a3]):
        a1a3.add(p)

a2a4 = set()
for i2 in range(1, N-2):
    a2 = A[i2]
    a4 = a2+1
    if a4 not in D:
        continue
    for p in itertools.product([i2], D[a4]):
        a2a4.add(p)

for a1, a3 in a1a3:
    for a2, a4 in a2a4:
        if a1<a2<a3<a4:
            ans+=1

print(ans)
0