結果
問題 |
No.390 最長の数列
|
ユーザー |
![]() |
提出日時 | 2025-04-18 17:22:30 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 456 bytes |
コンパイル時間 | 3,378 ms |
コンパイル使用メモリ | 280,888 KB |
実行使用メモリ | 11,296 KB |
最終ジャッジ日時 | 2025-04-18 17:22:41 |
合計ジャッジ時間 | 10,036 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 1 TLE * 1 -- * 13 |
ソースコード
#include<bits/stdc++.h> using namespace std; vector<int>mp[100003]; int dfs(int i,int l){ if(mp[i].empty())return l; int ret=0; for(int j:mp[i]){ ret=max(ret,dfs(j,l+1)); } return ret; } int main(){ int n;cin>>n; vector<int>a(n); for(auto&i:a)cin>>i; sort(a.begin(),a.end()); for(int i=0;i<n;i++){ for(int j=i+1;j<n;j++){ if(a[j]%a[i]==0)mp[i].push_back(j); } }int ma=0; for(int i=0;i<n;i++)ma=max(dfs(i,1),ma); cout<<ma; return 0; }