結果
問題 | No.2218 Multiple LIS |
ユーザー |
👑 ![]() |
提出日時 | 2023-02-17 21:36:30 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 218 ms / 3,000 ms |
コード長 | 429 bytes |
コンパイル時間 | 145 ms |
コンパイル使用メモリ | 82,176 KB |
実行使用メモリ | 99,968 KB |
最終ジャッジ日時 | 2024-07-19 12:42:38 |
合計ジャッジ時間 | 5,244 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 39 |
ソースコード
def solve(): N=int(input()) A=list(map(int,input().split())) A_max=max(A) div=[[] for _ in range(A_max+1)] for a in range(1,A_max+1): for b in range(a,A_max+1,a): div[b].append(a) DP=[0]*(A_max+1) for a in A: x=0 for b in div[a]: x=max(x, DP[b]) DP[a]=x+1 return max(DP) #================================================== print(solve())