結果

問題 No.979 Longest Divisor Sequence
ユーザー H3PO4H3PO4
提出日時 2022-08-31 15:24:35
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 403 bytes
コンパイル時間 145 ms
コンパイル使用メモリ 82,892 KB
実行使用メモリ 76,316 KB
最終ジャッジ日時 2024-04-25 21:13:14
合計ジャッジ時間 5,148 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 44 ms
75,144 KB
testcase_01 AC 49 ms
68,540 KB
testcase_02 AC 45 ms
68,968 KB
testcase_03 AC 45 ms
67,868 KB
testcase_04 AC 45 ms
67,928 KB
testcase_05 WA -
testcase_06 AC 44 ms
68,076 KB
testcase_07 WA -
testcase_08 AC 44 ms
68,244 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 TLE -
testcase_14 -- -
testcase_15 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

input = sys.stdin.buffer.readline

N = int(input())
A = tuple(map(int, input().split()))
MAX = 3 * 10 ** 5
table = [[] for _ in range(MAX + 1)]
for i, a in enumerate(A):
    table[a].append(i)
dp = [0] * N
dp[0] = 1
for i, a in enumerate(A):
    for b in range(a * 2, MAX + 1, a):
        for j in table[b]:
            if i < j:
                dp[j] = max(dp[j], dp[i] + 1)
print(max(dp))
0