結果
| 問題 | No.979 Longest Divisor Sequence |
| コンテスト | |
| ユーザー |
noshi91
|
| 提出日時 | 2019-10-07 23:40:57 |
| 言語 | C++14 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 407 bytes |
| 記録 | |
| コンパイル時間 | 517 ms |
| コンパイル使用メモリ | 85,564 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-05-02 14:50:51 |
| 合計ジャッジ時間 | 5,665 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 13 TLE * 1 -- * 2 |
ソースコード
#include <algorithm>
#include <iostream>
#include <vector>
int main() {
int n;
std::cin >> n;
std::vector<int> a(n), dp(n);
for (int i = 0; i < n; ++i) {
std::cin >> a[i];
int t = 0;
for (int j = 0; j < i; ++j) {
if (a[i] > a[j] && a[i] % a[j] == 0) {
t = std::max(t, dp[j]);
}
}
dp[i] = t + 1;
}
std::cout << *std::max_element(dp.cbegin(), dp.cend());
}
noshi91