結果
| 問題 |
No.2218 Multiple LIS
|
| コンテスト | |
| ユーザー |
vjudge1
|
| 提出日時 | 2023-08-29 10:49:40 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 153 ms / 3,000 ms |
| コード長 | 522 bytes |
| コンパイル時間 | 569 ms |
| コンパイル使用メモリ | 64,868 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-12-30 23:13:08 |
| 合計ジャッジ時間 | 3,221 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge6 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 39 |
ソースコード
#include <iostream>
using namespace std;
const int N = 114514;
int a[N], b[N], dp[N];
int main(){
ios::sync_with_stdio(0);
cin.tie(0), cout.tie(0);
int n, ans = 0;
cin >> n;
for(int i = 1; i <= n; i++) {
cin >> a[i];
}
for(int i = 1; i <= n; i++) {
dp[i] = 1;
for(int j = 1; j * j <= a[i]; j++) {
if(a[i] % j == 0) {
dp[i] = max(max(dp[i], b[j] + 1), b[a[i] / j] + 1);
}
}
b[a[i]] = max(b[a[i]], dp[i]);
ans = max(ans, dp[i]);
}
cout << ans;
return 0;
}
vjudge1