結果
| 問題 |
No.2218 Multiple LIS
|
| コンテスト | |
| ユーザー |
vjudge1
|
| 提出日時 | 2024-02-22 10:31:28 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 127 ms / 3,000 ms |
| コード長 | 436 bytes |
| コンパイル時間 | 1,461 ms |
| コンパイル使用メモリ | 166,640 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-09-29 04:25:14 |
| 合計ジャッジ時間 | 3,862 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 39 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
const int MAXV = 100001;
int n, dp[MAXV], ans;
void C(int x) {
for(int i = 1; i * i <= x; ++i) {
if(x % i == 0) {
dp[x] = max({dp[x], dp[i] + 1, dp[x / i] + 1});
}
}
}
int main() {
ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
cin >> n;
for(int i = 1, x; i <= n; ++i) {
cin >> x;
C(x);
ans = max(ans, dp[x]);
}
cout << ans;
return 0;
}
vjudge1