結果

問題 No.2374 ASKT Subsequences
ユーザー hibit_athibit_at
提出日時 2023-06-16 20:18:36
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 511 bytes
コンパイル時間 138 ms
コンパイル使用メモリ 82,496 KB
実行使用メモリ 192,108 KB
最終ジャッジ日時 2024-06-29 22:36:32
合計ジャッジ時間 21,028 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
76,416 KB
testcase_01 AC 84 ms
76,696 KB
testcase_02 AC 75 ms
76,672 KB
testcase_03 AC 84 ms
76,288 KB
testcase_04 AC 96 ms
77,312 KB
testcase_05 AC 79 ms
76,544 KB
testcase_06 AC 80 ms
76,544 KB
testcase_07 AC 124 ms
77,312 KB
testcase_08 AC 103 ms
76,864 KB
testcase_09 AC 115 ms
77,104 KB
testcase_10 AC 155 ms
77,012 KB
testcase_11 AC 315 ms
78,436 KB
testcase_12 AC 213 ms
77,696 KB
testcase_13 AC 207 ms
78,044 KB
testcase_14 AC 396 ms
80,252 KB
testcase_15 AC 486 ms
81,876 KB
testcase_16 AC 350 ms
79,304 KB
testcase_17 AC 611 ms
85,896 KB
testcase_18 AC 937 ms
96,268 KB
testcase_19 AC 860 ms
94,244 KB
testcase_20 AC 1,230 ms
118,488 KB
testcase_21 AC 1,365 ms
127,804 KB
testcase_22 AC 1,075 ms
110,448 KB
testcase_23 AC 966 ms
96,452 KB
testcase_24 AC 889 ms
96,680 KB
testcase_25 AC 690 ms
90,240 KB
testcase_26 AC 1,997 ms
159,792 KB
testcase_27 AC 1,230 ms
130,276 KB
testcase_28 AC 1,467 ms
131,212 KB
testcase_29 TLE -
testcase_30 AC 1,541 ms
141,728 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