結果
問題 |
No.2218 Multiple LIS
|
ユーザー |
![]() |
提出日時 | 2023-08-29 10:58:49 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 124 ms / 3,000 ms |
コード長 | 404 bytes |
コンパイル時間 | 1,691 ms |
コンパイル使用メモリ | 166,612 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-12-30 23:16:37 |
合計ジャッジ時間 | 4,338 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 39 |
ソースコード
#include<bits/stdc++.h> using namespace std; int m[100010],a[100010],ans,n,dp[100010]; int main(){ ios::sync_with_stdio(0); cin.tie(0),cout.tie(0); cin>>n; for(int i=1;i<=n;i++){ cin>>a[i]; } for(int i=1;i<=n;i++){ for(int j=1;j*j<=a[i];j++){ if(a[i]%j!=0)continue; m[a[i]]=max({m[a[i]],m[j]+1,m[a[i]/j]+1}); } ans=max(ans,m[a[i]]); } cout<<ans; return 0; }