結果
| 問題 |
No.2218 Multiple LIS
|
| コンテスト | |
| ユーザー |
vjudge1
|
| 提出日時 | 2023-08-29 12:38:31 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 383 ms / 3,000 ms |
| コード長 | 452 bytes |
| コンパイル時間 | 1,536 ms |
| コンパイル使用メモリ | 167,048 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-12-30 23:28:49 |
| 合計ジャッジ時間 | 6,156 ms |
|
ジャッジサーバーID (参考情報) |
judge6 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 39 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 10;
long long n, a[MAXN], dp[MAXN], ans;
int main(){
cin >> n;
for(int i = 1; i <= n; i++){
cin >> a[i];
}
for(int i = 1; i <= n; i++){
// dp[a[i]] = 1;
for(long long j = 1; j * j <= a[i]; j++){
if(!(a[i] % j)){
dp[a[i]] = max({dp[a[i]], dp[j] + 1, dp[a[i] / j] + 1});
}
}
ans = max(dp[a[i]], ans);
}
cout << ans;
return 0;
}
vjudge1