結果

問題 No.979 Longest Divisor Sequence
ユーザー ああいいああいい
提出日時 2022-02-23 15:31:49
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,235 ms / 2,000 ms
コード長 363 bytes
コンパイル時間 931 ms
コンパイル使用メモリ 86,552 KB
実行使用メモリ 190,420 KB
最終ジャッジ日時 2023-09-14 07:46:37
合計ジャッジ時間 18,586 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 996 ms
171,288 KB
testcase_01 AC 960 ms
170,976 KB
testcase_02 AC 989 ms
171,288 KB
testcase_03 AC 999 ms
171,208 KB
testcase_04 AC 985 ms
171,292 KB
testcase_05 AC 998 ms
171,228 KB
testcase_06 AC 1,016 ms
171,116 KB
testcase_07 AC 1,007 ms
170,964 KB
testcase_08 AC 1,010 ms
171,200 KB
testcase_09 AC 981 ms
171,316 KB
testcase_10 AC 996 ms
170,988 KB
testcase_11 AC 985 ms
170,976 KB
testcase_12 AC 998 ms
170,928 KB
testcase_13 AC 1,018 ms
165,608 KB
testcase_14 AC 1,235 ms
190,420 KB
testcase_15 AC 1,106 ms
169,156 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A = list(map(int,input().split()))
C = 3 * 10 ** 5 + 1
dat = [[] for _ in range(C)]
for i in range(1,C):
    for j in range(i * 2,C,i):
        dat[j].append(i)
dp = [0] * C
for a in A:
    dp[a] = max(dp[a],1)
    _max = 0
    for v in dat[a]:
        if dp[v] + 1 > _max:
            _max = dp[v] + 1
    dp[a] = max(dp[a],_max)
print(max(dp))
0