結果

問題 No.979 Longest Divisor Sequence
ユーザー chinchillachinchilla
提出日時 2020-02-16 20:35:56
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,174 ms / 2,000 ms
コード長 223 bytes
コンパイル時間 111 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 32,984 KB
最終ジャッジ日時 2024-04-16 03:40:46
合計ジャッジ時間 3,992 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 54 ms
13,312 KB
testcase_01 AC 74 ms
13,828 KB
testcase_02 AC 78 ms
14,336 KB
testcase_03 AC 60 ms
13,696 KB
testcase_04 AC 102 ms
15,232 KB
testcase_05 AC 80 ms
13,192 KB
testcase_06 AC 92 ms
13,824 KB
testcase_07 AC 83 ms
13,772 KB
testcase_08 AC 118 ms
15,360 KB
testcase_09 AC 79 ms
13,568 KB
testcase_10 AC 54 ms
13,056 KB
testcase_11 AC 58 ms
13,312 KB
testcase_12 AC 54 ms
13,184 KB
testcase_13 AC 246 ms
18,424 KB
testcase_14 AC 1,174 ms
32,984 KB
testcase_15 AC 484 ms
19,456 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
l = [1]*(1+300000)
for w in input().split():
	a = b = int(w)
	m = l[a]
	while b%2==0: m, b = max(m, l[b//2]|1), b//2
	if m%2:
		l[a] = m+1
		l[a*3::a*2] = (max(k, m+2) for k in l[a*3::a*2])
print(max(l)//2)
0