結果

問題 No.2374 ASKT Subsequences
ユーザー hibit_athibit_at
提出日時 2023-06-16 17:59:35
言語 PyPy3
(7.3.15)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 441 bytes
コンパイル時間 294 ms
コンパイル使用メモリ 87,140 KB
実行使用メモリ 167,660 KB
最終ジャッジ日時 2023-09-12 09:55:14
合計ジャッジ時間 27,519 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 152 ms
86,008 KB
testcase_01 AC 161 ms
78,536 KB
testcase_02 AC 143 ms
78,324 KB
testcase_03 AC 153 ms
78,332 KB
testcase_04 AC 185 ms
79,896 KB
testcase_05 AC 158 ms
78,720 KB
testcase_06 AC 154 ms
78,408 KB
testcase_07 AC 262 ms
80,144 KB
testcase_08 AC 215 ms
79,580 KB
testcase_09 AC 238 ms
79,560 KB
testcase_10 AC 347 ms
81,256 KB
testcase_11 AC 699 ms
87,156 KB
testcase_12 AC 469 ms
82,664 KB
testcase_13 AC 501 ms
84,856 KB
testcase_14 AC 861 ms
90,352 KB
testcase_15 AC 1,042 ms
94,996 KB
testcase_16 AC 764 ms
88,728 KB
testcase_17 AC 1,360 ms
106,264 KB
testcase_18 AC 1,788 ms
124,636 KB
testcase_19 AC 1,694 ms
121,360 KB
testcase_20 TLE -
testcase_21 TLE -
testcase_22 TLE -
testcase_23 AC 1,779 ms
122,264 KB
testcase_24 AC 1,788 ms
123,432 KB
testcase_25 AC 956 ms
86,724 KB
testcase_26 TLE -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict

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

ans = 0

for d in range(1, 1000):
    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
        mp[(a[i], 1)] += mp[(a[i] - 10 - d, 0)]
        mp[(a[i], 2)] += mp[(a[i] + d, 1)]
        ans += mp[(a[i] - d - 1, 2)]
        mp[(a[i], 3)] += mp[(a[i] - d - 1, 2)]
print(ans)
0