結果

問題 No.979 Longest Divisor Sequence
ユーザー convexineqconvexineq
提出日時 2021-05-05 03:49:49
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,452 ms / 2,000 ms
コード長 242 bytes
コンパイル時間 686 ms
コンパイル使用メモリ 87,200 KB
実行使用メモリ 195,732 KB
最終ジャッジ日時 2023-10-01 05:52:15
合計ジャッジ時間 21,049 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,048 ms
171,376 KB
testcase_01 AC 1,045 ms
171,164 KB
testcase_02 AC 1,059 ms
171,164 KB
testcase_03 AC 1,076 ms
171,436 KB
testcase_04 AC 1,071 ms
171,148 KB
testcase_05 AC 1,061 ms
171,392 KB
testcase_06 AC 1,064 ms
171,164 KB
testcase_07 AC 1,075 ms
171,568 KB
testcase_08 AC 1,079 ms
171,380 KB
testcase_09 AC 1,052 ms
171,436 KB
testcase_10 AC 1,082 ms
171,260 KB
testcase_11 AC 1,056 ms
171,264 KB
testcase_12 AC 1,048 ms
171,148 KB
testcase_13 AC 1,125 ms
195,336 KB
testcase_14 AC 1,452 ms
195,732 KB
testcase_15 AC 1,198 ms
173,136 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,*a = map(int,open(0).read().split())
M = 300005
d = [[] for _ in range(M)]
for i in range(1,M):
    for j in range(i*2,M,i):
        d[j].append(i)
r = [0]*M
for ai in a:
    r[ai] = max(r[di] for di in d[ai])+1 if ai>1 else 1
print(max(r))
0