結果
問題 |
No.979 Longest Divisor Sequence
|
ユーザー |
|
提出日時 | 2021-02-27 20:50:52 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 517 bytes |
コンパイル時間 | 233 ms |
コンパイル使用メモリ | 82,352 KB |
実行使用メモリ | 120,820 KB |
最終ジャッジ日時 | 2024-10-02 18:04:03 |
合計ジャッジ時間 | 4,616 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 15 TLE * 1 |
ソースコード
def divisors(n): i = 1 table = set() while i * i <= n: if not n % i: table.add(i) table.add(n//i) i += 1 table = sorted(list(table)) # 速度が欲しい時は消す return table import sys input = sys.stdin.readline N=int(input()) A=list(map(int, input().split())) dp=[-1]*(max(A) + 1) dp[1]=0 for a in A: tmp=0 for n in divisors(a): if n==a: continue if dp[n]==-1: continue tmp=max(tmp,dp[n]) dp[a]=tmp+1 print(max(dp))