結果
| 問題 | No.2218 Multiple LIS |
| コンテスト | |
| ユーザー |
stoq
|
| 提出日時 | 2022-01-29 13:25:34 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 620 bytes |
| 記録 | |
| コンパイル時間 | 1,347 ms |
| コンパイル使用メモリ | 215,280 KB |
| 実行使用メモリ | 13,184 KB |
| 最終ジャッジ日時 | 2026-06-25 04:00:08 |
| 合計ジャッジ時間 | 11,389 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 TLE * 2 -- * 16 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < int(n); i++)
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
template <typename T>
inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
int main() {
cin.tie(nullptr);
ios::sync_with_stdio(false);
int n;
cin >> n;
vector<int> a(n);
rep(i, n) cin >> a[i];
vector<int> dp(n, 0);
rep(i, n) {
rep(j, i) if (a[i] % a[j] == 0) chmax(dp[i], dp[j]);
dp[i]++;
}
int ans = 0;
rep(i, n) chmax(ans, dp[i]);
cout << ans << "\n";
}
stoq