結果

問題 No.2374 ASKT Subsequences
ユーザー hibit_athibit_at
提出日時 2023-06-16 17:35:55
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 470 bytes
コンパイル時間 317 ms
コンパイル使用メモリ 86,992 KB
実行使用メモリ 221,468 KB
最終ジャッジ日時 2023-09-12 09:53:23
合計ジャッジ時間 30,567 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 127 ms
78,536 KB
testcase_01 AC 139 ms
78,268 KB
testcase_02 AC 132 ms
78,744 KB
testcase_03 AC 137 ms
78,152 KB
testcase_04 AC 168 ms
78,804 KB
testcase_05 AC 140 ms
78,432 KB
testcase_06 AC 149 ms
78,396 KB
testcase_07 AC 213 ms
78,524 KB
testcase_08 AC 189 ms
78,212 KB
testcase_09 AC 204 ms
78,924 KB
testcase_10 AC 272 ms
79,076 KB
testcase_11 AC 490 ms
82,264 KB
testcase_12 WA -
testcase_13 AC 340 ms
79,876 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 958 ms
97,220 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 TLE -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 967 ms
86,884 KB
testcase_26 TLE -
testcase_27 AC 1,808 ms
109,580 KB
testcase_28 WA -
testcase_29 TLE -
testcase_30 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict

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

ans = 0

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