結果

問題 No.2218 Multiple LIS
ユーザー vjudge1
提出日時 2025-04-18 16:06:51
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 348 ms / 3,000 ms
コード長 408 bytes
コンパイル時間 1,456 ms
コンパイル使用メモリ 160,900 KB
実行使用メモリ 7,844 KB
最終ジャッジ日時 2025-04-18 16:06:57
合計ジャッジ時間 5,779 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 39
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define int long long

using namespace std;

const int kMaxN = 1e6 + 5;

int n, mx, f[kMaxN];

signed main() {
  cin.tie(0)->ios::sync_with_stdio(0);
  cin >> n;
  for (int i = 1, x; i <= n; i++) {
    cin >> x;
    for (int j = 1; j * j <= x; j++) {
      if (x % j == 0) {
        f[x] = max(f[x], max(f[j], f[x / j]) + 1);
      }
    }
    mx = max(mx, f[x]);
  }
  cout << mx;
}
0