結果
問題 | No.979 Longest Divisor Sequence |
ユーザー |
![]() |
提出日時 | 2020-02-01 15:34:19 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 450 bytes |
コンパイル時間 | 1,616 ms |
コンパイル使用メモリ | 168,540 KB |
実行使用メモリ | 15,008 KB |
最終ジャッジ日時 | 2024-09-18 20:04:05 |
合計ジャッジ時間 | 5,323 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 12 WA * 1 TLE * 1 -- * 2 |
ソースコード
#include<bits/stdc++.h> using namespace std; #ifdef LOCAL_DEBUG #include "LOCAL_DEBUG.hpp" #endif #define int long long signed main(){ int n; cin >> n; vector<int> a(n); for(int i = 0; i < n; i++){ cin >> a[i]; } vector<int> dp(3e5+1, 0); for(int i = 0; i < n; i++){ for(int j = a[i]*2; j <= 3e5; j+=a[i]){ dp[j] = max(dp[j], dp[a[i]] + 1); } } cout << *max_element(dp.begin(),dp.end()) << endl; return 0; }