結果

問題 No.2374 ASKT Subsequences
ユーザー hibit_athibit_at
提出日時 2023-06-16 20:18:36
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 511 bytes
コンパイル時間 398 ms
コンパイル使用メモリ 87,104 KB
実行使用メモリ 192,956 KB
最終ジャッジ日時 2023-09-12 09:56:08
合計ジャッジ時間 25,426 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
78,044 KB
testcase_01 AC 139 ms
78,628 KB
testcase_02 AC 126 ms
78,224 KB
testcase_03 AC 129 ms
78,228 KB
testcase_04 AC 144 ms
78,504 KB
testcase_05 AC 131 ms
78,216 KB
testcase_06 AC 128 ms
78,084 KB
testcase_07 AC 174 ms
78,680 KB
testcase_08 AC 160 ms
78,948 KB
testcase_09 AC 167 ms
78,580 KB
testcase_10 AC 211 ms
78,608 KB
testcase_11 AC 371 ms
80,020 KB
testcase_12 AC 272 ms
79,000 KB
testcase_13 AC 269 ms
79,332 KB
testcase_14 AC 483 ms
81,568 KB
testcase_15 AC 586 ms
83,888 KB
testcase_16 AC 414 ms
80,732 KB
testcase_17 AC 728 ms
87,772 KB
testcase_18 AC 1,086 ms
98,380 KB
testcase_19 AC 1,007 ms
95,732 KB
testcase_20 AC 1,436 ms
119,224 KB
testcase_21 AC 1,614 ms
129,364 KB
testcase_22 AC 1,288 ms
110,780 KB
testcase_23 AC 1,101 ms
99,208 KB
testcase_24 AC 1,099 ms
98,972 KB
testcase_25 AC 781 ms
92,396 KB
testcase_26 TLE -
testcase_27 AC 1,469 ms
132,196 KB
testcase_28 AC 1,697 ms
133,644 KB
testcase_29 TLE -
testcase_30 AC 1,799 ms
144,440 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict

n = int(input())
a = list(map(int, input().split(' ')))

ans = 0

for d in range(1, 2000):
    dp = [[0 for j in range(4)] for i in range(n)]
    mp = defaultdict(int)
    for i in range(n):
        mp[(a[i], 0)] += 1
        if (a[i] - 10 - d, 0) in mp:
            mp[(a[i], 1)] += mp[(a[i] - 10 - d, 0)]
        if (a[i] + d, 1) in mp:
            mp[(a[i], 2)] += mp[(a[i] + d, 1)]
        if (a[i] - d - 1, 2) in mp:
            ans += mp[(a[i] - d - 1, 2)]
print(ans)
0