結果

問題 No.2218 Multiple LIS
ユーザー vjudge1vjudge1
提出日時 2023-08-29 12:31:39
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 378 ms / 3,000 ms
コード長 386 bytes
コンパイル時間 1,741 ms
コンパイル使用メモリ 165,464 KB
実行使用メモリ 5,012 KB
最終ジャッジ日時 2023-08-29 12:31:47
合計ジャッジ時間 7,594 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,384 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 2 ms
4,384 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 1 ms
4,384 KB
testcase_07 AC 2 ms
4,384 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 2 ms
4,384 KB
testcase_10 AC 2 ms
4,384 KB
testcase_11 AC 2 ms
4,384 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 2 ms
4,384 KB
testcase_14 AC 2 ms
4,384 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 AC 1 ms
4,384 KB
testcase_17 AC 2 ms
4,380 KB
testcase_18 AC 1 ms
4,380 KB
testcase_19 AC 2 ms
4,384 KB
testcase_20 AC 2 ms
4,384 KB
testcase_21 AC 16 ms
4,380 KB
testcase_22 AC 98 ms
4,472 KB
testcase_23 AC 165 ms
4,676 KB
testcase_24 AC 35 ms
4,468 KB
testcase_25 AC 186 ms
4,620 KB
testcase_26 AC 261 ms
5,012 KB
testcase_27 AC 261 ms
4,892 KB
testcase_28 AC 259 ms
4,992 KB
testcase_29 AC 269 ms
4,920 KB
testcase_30 AC 264 ms
4,944 KB
testcase_31 AC 79 ms
4,380 KB
testcase_32 AC 79 ms
4,380 KB
testcase_33 AC 78 ms
4,384 KB
testcase_34 AC 78 ms
4,380 KB
testcase_35 AC 79 ms
4,380 KB
testcase_36 AC 17 ms
4,384 KB
testcase_37 AC 378 ms
4,384 KB
testcase_38 AC 2 ms
4,384 KB
testcase_39 AC 1 ms
4,380 KB
testcase_40 AC 306 ms
4,380 KB
testcase_41 AC 305 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
const int kMaxN=1e5+3;
long long n,a[kMaxN],d[kMaxN],ans;
int main(){
  cin>>n;
  for(int i=1;i<=n;i++){
    cin>>a[i];
    d[a[i]]=1;
  }
  for(int i=1;i<=n;i++){
    for(int j=1;j*j<=a[i];j++){
      if(a[i]%j==0){
        d[a[i]]=max({d[a[i]],d[j]+1,d[a[i]/j]+1});
      }
    }
    ans=max(ans,d[a[i]]);
  }
  cout<<ans-1;
  return 0;
}
0