結果
問題 |
No.390 最長の数列
|
ユーザー |
![]() |
提出日時 | 2025-04-18 16:24:47 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 555 bytes |
コンパイル時間 | 1,687 ms |
コンパイル使用メモリ | 162,428 KB |
実行使用メモリ | 13,064 KB |
最終ジャッジ日時 | 2025-04-18 16:24:55 |
合計ジャッジ時間 | 8,515 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | WA * 1 TLE * 1 -- * 13 |
ソースコード
#include<bits/stdc++.h> #define int long long using namespace std; int const N=1e6+5; int n,m,sum,cnt,t,ans,a[N]; int c[N]; bool p[N]; signed main() { // freopen(".in","r",stdin); // freopen(".out","r",stdout); ios::sync_with_stdio(0); cin.tie(0),cout.tie(0); cin>>n; for(int i=1;i<=n;i++) cin>>a[i]; sort(a+1,a+1+n); for(int i=1;i<n;i++) { int p=1; int lst=a[i]; for(int j=i+1;j<=n;j++) { if(a[j]%lst==0) { p++; lst=a[j]; } } ans=max(p,ans); } cout<<ans; return 0; }