結果

問題 No.390 最長の数列
ユーザー daleksprinterdaleksprinter
提出日時 2018-08-27 15:40:11
言語 Python2
(2.7.18)
結果
TLE  
実行時間 -
コード長 348 bytes
コンパイル時間 148 ms
コンパイル使用メモリ 6,488 KB
実行使用メモリ 13,808 KB
最終ジャッジ日時 2023-09-17 04:04:46
合計ジャッジ時間 7,406 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 45 ms
13,792 KB
testcase_01 AC 45 ms
13,808 KB
testcase_02 AC 45 ms
13,756 KB
testcase_03 AC 45 ms
13,788 KB
testcase_04 AC 44 ms
13,632 KB
testcase_05 TLE -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())

arr = map(int,raw_input().split())

arr.sort()

def divisor(n):
	ret = []
	i = 1
	while i ** 2 <= n : 
		if n % i == 0 :
			ret.append(i)
			if i ** 2 != n:
				ret.append(n/i)
		i += 1
	ret.sort()
	ret.reverse()
	return ret

dp = [0]*(10**6+1)

for i in arr:
	for k in divisor(i):
			dp[i] = max(dp[i], dp[k] + 1)
	
print max(dp)
0