結果

問題 No.2374 ASKT Subsequences
ユーザー 👑 rin204rin204
提出日時 2023-07-07 21:35:38
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 378 ms / 2,000 ms
コード長 402 bytes
コンパイル時間 287 ms
コンパイル使用メモリ 87,064 KB
実行使用メモリ 158,844 KB
最終ジャッジ日時 2023-09-28 22:35:05
合計ジャッジ時間 5,552 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,680 KB
testcase_01 AC 75 ms
71,432 KB
testcase_02 AC 74 ms
71,428 KB
testcase_03 AC 74 ms
71,564 KB
testcase_04 AC 72 ms
71,364 KB
testcase_05 AC 75 ms
71,464 KB
testcase_06 AC 75 ms
71,120 KB
testcase_07 AC 75 ms
71,364 KB
testcase_08 AC 74 ms
71,420 KB
testcase_09 AC 77 ms
71,324 KB
testcase_10 AC 86 ms
76,100 KB
testcase_11 AC 95 ms
76,600 KB
testcase_12 AC 83 ms
76,172 KB
testcase_13 AC 84 ms
76,180 KB
testcase_14 AC 95 ms
76,672 KB
testcase_15 AC 99 ms
76,768 KB
testcase_16 AC 92 ms
76,608 KB
testcase_17 AC 115 ms
85,008 KB
testcase_18 AC 145 ms
92,496 KB
testcase_19 AC 141 ms
91,160 KB
testcase_20 AC 214 ms
112,532 KB
testcase_21 AC 229 ms
112,608 KB
testcase_22 AC 190 ms
106,116 KB
testcase_23 AC 146 ms
92,572 KB
testcase_24 AC 155 ms
92,548 KB
testcase_25 AC 90 ms
76,424 KB
testcase_26 AC 378 ms
148,016 KB
testcase_27 AC 105 ms
76,836 KB
testcase_28 AC 158 ms
77,040 KB
testcase_29 AC 190 ms
158,844 KB
testcase_30 AC 134 ms
90,088 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

L = []
R = []
l = {}
for a in A:
    L.append(l.copy())
    l[a] = l.get(a, 0) + 1

r = {}
for a in A[::-1]:
    R.append(r.copy())
    r[a] = r.get(a, 0) + 1

R = R[::-1]
ans = 0
for l in range(n):
    for r in range(l + 1, n):
        if A[r] >= A[l]:
            continue
        ans += L[l].get(A[r] - 10, 0) * R[r].get(A[l] + 1, 0)
print(ans)
0