結果

問題 No.2374 ASKT Subsequences
ユーザー ntudantuda
提出日時 2023-07-09 11:59:33
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 524 bytes
コンパイル時間 290 ms
コンパイル使用メモリ 86,960 KB
実行使用メモリ 304,844 KB
最終ジャッジ日時 2023-09-30 14:59:14
合計ジャッジ時間 14,738 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,384 KB
testcase_01 AC 77 ms
75,064 KB
testcase_02 AC 73 ms
71,520 KB
testcase_03 AC 79 ms
75,716 KB
testcase_04 AC 84 ms
76,336 KB
testcase_05 AC 80 ms
75,828 KB
testcase_06 AC 78 ms
75,232 KB
testcase_07 AC 121 ms
78,584 KB
testcase_08 AC 114 ms
78,128 KB
testcase_09 AC 118 ms
78,412 KB
testcase_10 AC 245 ms
129,792 KB
testcase_11 AC 216 ms
127,556 KB
testcase_12 AC 162 ms
96,932 KB
testcase_13 AC 157 ms
92,016 KB
testcase_14 AC 279 ms
179,900 KB
testcase_15 AC 360 ms
248,940 KB
testcase_16 AC 246 ms
147,624 KB
testcase_17 AC 1,377 ms
293,464 KB
testcase_18 TLE -
testcase_19 TLE -
testcase_20 TLE -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A = list(map(int, input().split()))
maxa = max(A)
dp = [[0] * (maxa + 1) for _ in range(N + 1)]
dp[0][0] = 1

ans = 0
for k in range(1, maxa):
    dp = [[0] * (maxa + 1) for _ in range(N + 1)]
    dp[0][0] = 1
    for a in A:
        dp[1][a] += dp[0][0]
        if 0 < a - k - 10 <= maxa:
            dp[2][a] += dp[1][a - k - 10]
        if 0 < a + k <= maxa:
            dp[3][a] += dp[2][a + k]
        if 0 < a - k - 1 <= maxa:
            dp[4][a] += dp[3][a - k - 1]
    ans += sum(dp[4])
print(ans)
0