結果
問題 |
No.2218 Multiple LIS
|
ユーザー |
![]() |
提出日時 | 2023-08-29 11:00:20 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 473 bytes |
コンパイル時間 | 2,202 ms |
コンパイル使用メモリ | 191,388 KB |
最終ジャッジ日時 | 2025-02-16 15:30:34 |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 20 TLE * 1 -- * 18 |
ソースコード
#include<bits/stdc++.h> using namespace std; const int MAXN = 1e5 + 5; int n, a[MAXN], dp[MAXN]; int main(){ ios::sync_with_stdio(0), cin.tie(0), cout.tie(0); int n; cin >> n; for (int i = 1; i <= n; i++){ cin >> a[i]; dp[i] = 1; } int ans = -1; for (int i = 1; i <= n; i++){ for (int j = 1; j < i; j++){ if (a[i] % a[j] == 0){ dp[i] = max(dp[i], dp[j] + 1); } } ans = max(ans, dp[i]); } cout << ans; return 0; }