結果

問題 No.2218 Multiple LIS
ユーザー vjudge1vjudge1
提出日時 2023-08-29 12:15:17
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
MLE  
実行時間 -
コード長 693 bytes
コンパイル時間 3,412 ms
コンパイル使用メモリ 166,968 KB
実行使用メモリ 814,248 KB
最終ジャッジ日時 2023-08-29 12:15:26
合計ジャッジ時間 7,116 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
9,456 KB
testcase_01 AC 5 ms
9,468 KB
testcase_02 AC 4 ms
9,472 KB
testcase_03 AC 4 ms
9,512 KB
testcase_04 AC 5 ms
9,556 KB
testcase_05 AC 5 ms
9,416 KB
testcase_06 AC 5 ms
9,432 KB
testcase_07 AC 5 ms
9,472 KB
testcase_08 AC 5 ms
9,468 KB
testcase_09 AC 5 ms
9,492 KB
testcase_10 AC 4 ms
9,404 KB
testcase_11 AC 5 ms
9,408 KB
testcase_12 AC 4 ms
9,488 KB
testcase_13 AC 5 ms
9,496 KB
testcase_14 AC 5 ms
9,536 KB
testcase_15 AC 5 ms
9,556 KB
testcase_16 AC 4 ms
9,556 KB
testcase_17 AC 5 ms
9,620 KB
testcase_18 AC 5 ms
9,696 KB
testcase_19 AC 5 ms
9,432 KB
testcase_20 AC 5 ms
9,624 KB
testcase_21 AC 19 ms
9,792 KB
testcase_22 AC 117 ms
11,584 KB
testcase_23 AC 196 ms
13,116 KB
testcase_24 AC 44 ms
10,196 KB
testcase_25 AC 227 ms
13,732 KB
testcase_26 AC 342 ms
16,668 KB
testcase_27 AC 339 ms
17,008 KB
testcase_28 AC 337 ms
16,408 KB
testcase_29 AC 337 ms
15,852 KB
testcase_30 AC 335 ms
16,412 KB
testcase_31 MLE -
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],s[kMaxN];
void F(long long x){
  for(long long i=1;i*i<=x;i++){
    if(x%i==0){
      if(w[i].size()){
        for(int j:w[i]){
          s[x].push_back(j);
        }
      }
      if(i*i!=x&&w[x/i].size()){
        for(int j:w[x/i]){
          s[x].push_back(j);
        }
      }
    }
  }
}
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(j<i){
        d[i]=max(d[i],d[j]+1);
      }
    }
    ans=max(ans,d[i]);
  }
  cout<<ans;
  return 0;
}
0