結果
| 問題 |
No.979 Longest Divisor Sequence
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-11-14 21:28:12 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 504 bytes |
| コンパイル時間 | 2,729 ms |
| コンパイル使用メモリ | 247,360 KB |
| 実行使用メモリ | 13,636 KB |
| 最終ジャッジ日時 | 2024-11-30 06:27:07 |
| 合計ジャッジ時間 | 12,953 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 13 TLE * 3 |
ソースコード
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using std::cin;
using std::cout;
using std::vector;
inline void chmax(int& x, int y) { if (x < y) x = y; }
int main() {
int n;
cin >> n;
vector<int> a(n);
rep(i, n) cin >> a[i];
vector<int> dp(n);
rep(i, n) {
dp[i] = 1;
rep(j, i) {
if (a[i] == a[j]) continue;
if (a[i] % a[j] == 0)
chmax(dp[i], dp[j] + 1);
}
}
int ans = *max_element(dp.begin(), dp.end());
cout << ans << '\n';
return 0;
}