結果
| 問題 |
No.2218 Multiple LIS
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-02-17 21:39:34 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 124 ms / 3,000 ms |
| コード長 | 608 bytes |
| コンパイル時間 | 1,295 ms |
| コンパイル使用メモリ | 168,196 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-19 12:46:47 |
| 合計ジャッジ時間 | 4,286 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 39 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
const int MX = 1E5 + 1;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int n; cin >> n;
int d = sqrt(MX);
vector<int> ans(MX);
while (n--) {
int u; cin >> u;
for (int j = 1; j < d; j++) {
if (u % j == 0) {
ans[u] = max(ans[u], ans[j]);
}
}
ans[u]++;
if (u >= d) {
for (int j = u; j < MX; j += u) {
ans[j] = max(ans[j], ans[u]);
}
}
}
cout << *max_element(ans.begin(), ans.end());
}