結果

問題 No.2218 Multiple LIS
ユーザー chineristAC
提出日時 2023-02-17 23:18:21
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 621 ms / 3,000 ms
コード長 565 bytes
コンパイル時間 198 ms
コンパイル使用メモリ 82,300 KB
実行使用メモリ 92,664 KB
最終ジャッジ日時 2024-07-19 14:30:11
合計ジャッジ時間 8,745 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 39
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys,random,bisect
from collections import deque,defaultdict
from heapq import heapify,heappop,heappush
from itertools import permutations
from math import gcd,log

input = lambda :sys.stdin.readline().rstrip()
mi = lambda :map(int,input().split())
li = lambda :list(mi())

N = int(input())
A = li()

M = max(A)

dp = [0] * (M+1) 
for a in A:
    tmp = 1
    for d in range(1,a+1):
        if d*d > a:
            break

        if a % d == 0:
            tmp = max(tmp,dp[d]+1)
            tmp = max(tmp,dp[a//d]+1)
    dp[a] = max(dp[a],tmp)

print(max(dp))
0