結果

問題 No.979 Longest Divisor Sequence
ユーザー naesiranaesira
提出日時 2023-09-22 01:32:01
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 333 bytes
コンパイル時間 292 ms
コンパイル使用メモリ 87,008 KB
実行使用メモリ 129,200 KB
最終ジャッジ日時 2023-09-22 01:32:09
合計ジャッジ時間 7,036 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 97 ms
71,792 KB
testcase_01 AC 97 ms
71,860 KB
testcase_02 AC 100 ms
71,796 KB
testcase_03 AC 98 ms
72,000 KB
testcase_04 AC 97 ms
72,004 KB
testcase_05 AC 97 ms
71,696 KB
testcase_06 AC 97 ms
71,960 KB
testcase_07 AC 94 ms
71,960 KB
testcase_08 AC 101 ms
71,960 KB
testcase_09 AC 97 ms
72,004 KB
testcase_10 AC 175 ms
79,372 KB
testcase_11 AC 139 ms
79,712 KB
testcase_12 AC 141 ms
79,776 KB
testcase_13 AC 158 ms
123,820 KB
testcase_14 TLE -
testcase_15 AC 939 ms
109,072 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict

N = int(input())
A = list(map(int, input().split()))
dp = defaultdict(int)
for a in A:
	dp[a] = max(dp[a], 1)
	for d in range(1, int(a**0.5)+1):
		if a % d != 0: continue
		if d < a:
			dp[a] = max(dp[a], dp[d] + 1)
		if a//d < a:
			dp[a] = max(dp[a], dp[a//d] + 1)
K = max(dp.values())
print(K)
0