結果

問題 No.2218 Multiple LIS
ユーザー vjudge1vjudge1
提出日時 2023-08-29 12:19:49
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 642 bytes
コンパイル時間 3,218 ms
コンパイル使用メモリ 168,880 KB
実行使用メモリ 24,040 KB
最終ジャッジ日時 2023-08-29 12:20:01
合計ジャッジ時間 10,068 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
9,484 KB
testcase_01 AC 4 ms
9,468 KB
testcase_02 AC 4 ms
9,436 KB
testcase_03 AC 5 ms
9,436 KB
testcase_04 AC 4 ms
9,392 KB
testcase_05 AC 5 ms
9,528 KB
testcase_06 AC 4 ms
9,408 KB
testcase_07 AC 5 ms
9,452 KB
testcase_08 AC 4 ms
9,608 KB
testcase_09 AC 5 ms
9,404 KB
testcase_10 AC 5 ms
9,476 KB
testcase_11 AC 4 ms
9,596 KB
testcase_12 AC 5 ms
9,476 KB
testcase_13 AC 5 ms
9,528 KB
testcase_14 AC 5 ms
9,704 KB
testcase_15 AC 5 ms
9,472 KB
testcase_16 AC 5 ms
9,420 KB
testcase_17 AC 6 ms
9,472 KB
testcase_18 AC 4 ms
9,376 KB
testcase_19 AC 5 ms
9,536 KB
testcase_20 AC 5 ms
9,568 KB
testcase_21 AC 22 ms
10,288 KB
testcase_22 AC 129 ms
14,920 KB
testcase_23 AC 229 ms
18,632 KB
testcase_24 AC 46 ms
11,412 KB
testcase_25 AC 256 ms
19,748 KB
testcase_26 AC 382 ms
24,016 KB
testcase_27 AC 378 ms
23,960 KB
testcase_28 AC 372 ms
24,040 KB
testcase_29 AC 378 ms
23,952 KB
testcase_30 AC 375 ms
23,992 KB
testcase_31 TLE -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
const int kMaxN=1e5+3;
long long n,a[kMaxN],d[kMaxN],ans;
vector<int> w[kMaxN];
vector<long long>s[kMaxN];
void F(long long x){
  for(long long i=1;i*i<=x;i++){
    if(x%i==0){
      s[x].push_back(i);
      if(i*i!=x){
        s[x].push_back(x/i);
      }
    }
  }
}
int main(){
  cin>>n;
  for(int i=1;i<=n;i++){
    cin>>a[i];
    d[i]=1,w[a[i]].push_back(i);
    F(a[i]);
  }
  for(int i=1;i<=n;i++){
    for(int j:s[a[i]]){
      if(w[j].size()){
        for(int k:w[j]){
          if(k<i) d[i]=max(d[i],d[k]+1);
        }
      }
    }
    ans=max(ans,d[i]);
  }
  cout<<ans;
  return 0;
}
0