結果

問題 No.2374 ASKT Subsequences
ユーザー shogo314shogo314
提出日時 2023-07-07 21:56:55
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 659 bytes
コンパイル時間 346 ms
コンパイル使用メモリ 87,320 KB
実行使用メモリ 79,444 KB
最終ジャッジ日時 2023-09-28 23:07:50
合計ジャッジ時間 12,076 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 88 ms
76,772 KB
testcase_01 AC 86 ms
76,720 KB
testcase_02 AC 79 ms
76,900 KB
testcase_03 AC 82 ms
76,604 KB
testcase_04 AC 100 ms
77,300 KB
testcase_05 AC 80 ms
76,656 KB
testcase_06 AC 80 ms
76,872 KB
testcase_07 AC 111 ms
77,656 KB
testcase_08 AC 97 ms
77,744 KB
testcase_09 AC 101 ms
77,456 KB
testcase_10 AC 117 ms
77,720 KB
testcase_11 AC 160 ms
77,940 KB
testcase_12 AC 142 ms
78,052 KB
testcase_13 AC 142 ms
77,840 KB
testcase_14 AC 179 ms
78,072 KB
testcase_15 AC 215 ms
78,304 KB
testcase_16 AC 167 ms
78,132 KB
testcase_17 AC 256 ms
78,220 KB
testcase_18 AC 411 ms
77,868 KB
testcase_19 AC 380 ms
78,172 KB
testcase_20 AC 541 ms
78,144 KB
testcase_21 AC 668 ms
78,516 KB
testcase_22 AC 506 ms
78,460 KB
testcase_23 AC 419 ms
77,988 KB
testcase_24 AC 428 ms
78,248 KB
testcase_25 AC 88 ms
76,768 KB
testcase_26 AC 1,037 ms
78,892 KB
testcase_27 AC 97 ms
76,868 KB
testcase_28 AC 120 ms
77,692 KB
testcase_29 TLE -
testcase_30 AC 695 ms
79,444 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A = list(map(int, input().split()))
d = {}
for i, a in enumerate(A):
    if a in d:
        d[a].append(i)
    else:
        d[a] = [i]
ans = 0
for k in range(1, 2000):
    for i in d:
        tmp = []
        a = [i, 0, 0, 0]
        a[1] = a[0]+(k+10)
        a[2] = a[1]-k
        a[3] = a[2]+(k+1)
        if not all(a[j] in d for j in range(1, 4)):
            continue
        for x in range(4):
            for j in d[a[x]]:
                tmp.append((j, x))
        tmp.sort()
        dp = [1, 0, 0, 0, 0]
        for j, x in tmp:
            dp[x+1] += dp[x]
        # print(tmp)
        # print(dp)
        ans += dp[-1]
print(ans)
0