結果

問題 No.2374 ASKT Subsequences
ユーザー hibit_athibit_at
提出日時 2023-06-16 17:37:01
言語 PyPy3
(7.3.15)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 472 bytes
コンパイル時間 394 ms
コンパイル使用メモリ 87,180 KB
実行使用メモリ 220,700 KB
最終ジャッジ日時 2023-09-12 09:53:53
合計ジャッジ時間 22,833 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
78,564 KB
testcase_01 AC 138 ms
78,384 KB
testcase_02 AC 134 ms
78,452 KB
testcase_03 AC 131 ms
78,416 KB
testcase_04 AC 168 ms
78,720 KB
testcase_05 AC 134 ms
78,380 KB
testcase_06 AC 143 ms
78,372 KB
testcase_07 AC 204 ms
78,588 KB
testcase_08 AC 179 ms
78,288 KB
testcase_09 AC 199 ms
79,052 KB
testcase_10 AC 270 ms
79,640 KB
testcase_11 AC 463 ms
82,604 KB
testcase_12 AC 325 ms
79,840 KB
testcase_13 AC 320 ms
79,936 KB
testcase_14 AC 602 ms
85,532 KB
testcase_15 AC 702 ms
87,660 KB
testcase_16 AC 507 ms
83,240 KB
testcase_17 AC 937 ms
96,572 KB
testcase_18 AC 1,353 ms
113,548 KB
testcase_19 AC 1,232 ms
108,940 KB
testcase_20 WA -
testcase_21 TLE -
testcase_22 WA -
testcase_23 AC 1,322 ms
113,636 KB
testcase_24 AC 1,378 ms
114,148 KB
testcase_25 AC 972 ms
86,508 KB
testcase_26 TLE -
testcase_27 AC 1,817 ms
109,660 KB
testcase_28 AC 1,919 ms
110,452 KB
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(1,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