結果

問題 No.2374 ASKT Subsequences
ユーザー Kanten4205Kanten4205
提出日時 2023-06-16 18:09:27
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 506 bytes
コンパイル時間 270 ms
コンパイル使用メモリ 87,248 KB
実行使用メモリ 87,480 KB
最終ジャッジ日時 2023-09-12 09:54:02
合計ジャッジ時間 8,496 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
75,784 KB
testcase_01 AC 79 ms
76,492 KB
testcase_02 AC 72 ms
71,480 KB
testcase_03 AC 79 ms
76,536 KB
testcase_04 AC 90 ms
76,648 KB
testcase_05 AC 81 ms
76,536 KB
testcase_06 AC 83 ms
76,516 KB
testcase_07 AC 117 ms
77,672 KB
testcase_08 AC 106 ms
77,200 KB
testcase_09 AC 110 ms
77,320 KB
testcase_10 AC 141 ms
77,792 KB
testcase_11 AC 212 ms
77,540 KB
testcase_12 AC 141 ms
77,644 KB
testcase_13 AC 155 ms
77,584 KB
testcase_14 AC 368 ms
77,828 KB
testcase_15 AC 541 ms
78,160 KB
testcase_16 AC 223 ms
77,436 KB
testcase_17 AC 1,514 ms
79,784 KB
testcase_18 TLE -
testcase_19 -- -
testcase_20 -- -
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()))
Max = max(A);Min = min(A)
ans = 0
for k in range(1, Max - Min + 1):
    dp = [[0 for i in range(4)] for j in range(N)]
    for i in range(N):
        dp[i][0] = 1
        for j in range(i):
            if A[j] == A[i] - k - 10: dp[i][1] = dp[i][1] + dp[j][0]
            if A[j] == A[i] + k: dp[i][2] = dp[i][2] + dp[j][1]
            if A[j] == A[i] - 1 - k: dp[i][3] = dp[i][3] + dp[j][2]
    for i in range(N):
        ans = ans + dp[i][3]
print(ans)
0