結果
問題 |
No.390 最長の数列
|
ユーザー |
![]() |
提出日時 | 2025-04-18 16:35:42 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 421 bytes |
コンパイル時間 | 3,118 ms |
コンパイル使用メモリ | 285,116 KB |
実行使用メモリ | 11,684 KB |
最終ジャッジ日時 | 2025-04-18 16:35:53 |
合計ジャッジ時間 | 9,910 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | WA * 1 TLE * 1 -- * 13 |
ソースコード
#include<bits/stdc++.h> using namespace std; typedef long long ll; vector<ll>a; vector<bool>vis; ll n,ans=0; int main(){ cin>>n; a.resize(n+1),vis.resize(n+1); for(ll i=1;i<=n;i++)cin>>a[i],vis[i]=0; sort(a.begin()+1,a.begin()+1+n); for(ll i=1;i<=n;i++){ ll tmp=1,pre=a[i]; for(ll j=i+1;j<=n;j++){ if(a[j]%pre==0){ tmp++; pre=a[j]; } } ans=max(ans,tmp); } cout<<ans; } /* 1 2 4 8 22 88 440 */