結果

問題 No.2218 Multiple LIS
ユーザー vjudge1vjudge1
提出日時 2024-02-22 10:20:00
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 156 ms / 3,000 ms
コード長 558 bytes
コンパイル時間 1,651 ms
コンパイル使用メモリ 170,048 KB
実行使用メモリ 13,888 KB
最終ジャッジ日時 2024-02-22 10:20:09
合計ジャッジ時間 8,351 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 98 ms
13,248 KB
testcase_01 AC 98 ms
13,248 KB
testcase_02 AC 98 ms
13,248 KB
testcase_03 AC 99 ms
13,248 KB
testcase_04 AC 99 ms
13,248 KB
testcase_05 AC 99 ms
13,248 KB
testcase_06 AC 99 ms
13,248 KB
testcase_07 AC 99 ms
13,248 KB
testcase_08 AC 99 ms
13,248 KB
testcase_09 AC 99 ms
13,248 KB
testcase_10 AC 98 ms
13,248 KB
testcase_11 AC 99 ms
13,248 KB
testcase_12 AC 99 ms
13,248 KB
testcase_13 AC 100 ms
13,248 KB
testcase_14 AC 99 ms
13,248 KB
testcase_15 AC 99 ms
13,248 KB
testcase_16 AC 100 ms
13,248 KB
testcase_17 AC 99 ms
13,248 KB
testcase_18 AC 99 ms
13,248 KB
testcase_19 AC 99 ms
13,248 KB
testcase_20 AC 99 ms
13,248 KB
testcase_21 AC 102 ms
13,632 KB
testcase_22 AC 121 ms
13,760 KB
testcase_23 AC 131 ms
13,888 KB
testcase_24 AC 106 ms
13,632 KB
testcase_25 AC 134 ms
13,888 KB
testcase_26 AC 151 ms
13,888 KB
testcase_27 AC 151 ms
13,888 KB
testcase_28 AC 151 ms
13,888 KB
testcase_29 AC 150 ms
13,888 KB
testcase_30 AC 156 ms
13,888 KB
testcase_31 AC 124 ms
13,504 KB
testcase_32 AC 124 ms
13,504 KB
testcase_33 AC 124 ms
13,504 KB
testcase_34 AC 123 ms
13,504 KB
testcase_35 AC 124 ms
13,504 KB
testcase_36 AC 115 ms
13,504 KB
testcase_37 AC 136 ms
13,504 KB
testcase_38 AC 99 ms
13,248 KB
testcase_39 AC 100 ms
13,248 KB
testcase_40 AC 132 ms
13,504 KB
testcase_41 AC 130 ms
13,504 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>

using namespace std;

const int INF = 1e5;
const int N = 1e5 + 5;

vector<int> g[N];
int n, dp[N], num[N];

int main(){
  for(int i = 1; i <= INF; i++){
    for(int j = 1; j * j <= i; j++){
      if(i % j == 0){
        g[i].push_back(j);
        if(j * j != i){
          g[i].push_back(i / j);
        }
      }
    }
  }
  cin >> n;
  for(int i = 1, x; i <= n; i++){
    cin >> x;
    for(int v : g[x]){
      dp[i] = max(dp[i], num[v] + 1);
    }
    num[x] = dp[i];
  }
  cout << *max_element(dp + 1, dp + n + 1);
  return 0;
}
0