結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 5 ms
9,668 KB
testcase_01 AC 4 ms
9,408 KB
testcase_02 AC 4 ms
9,460 KB
testcase_03 AC 5 ms
9,480 KB
testcase_04 AC 4 ms
9,388 KB
testcase_05 AC 5 ms
9,548 KB
testcase_06 AC 4 ms
9,488 KB
testcase_07 AC 5 ms
9,408 KB
testcase_08 AC 5 ms
9,440 KB
testcase_09 AC 4 ms
9,484 KB
testcase_10 AC 4 ms
9,516 KB
testcase_11 AC 4 ms
9,676 KB
testcase_12 AC 5 ms
9,504 KB
testcase_13 AC 5 ms
9,868 KB
testcase_14 AC 5 ms
9,792 KB
testcase_15 AC 5 ms
9,532 KB
testcase_16 AC 4 ms
9,552 KB
testcase_17 AC 6 ms
9,660 KB
testcase_18 AC 5 ms
9,548 KB
testcase_19 AC 4 ms
9,384 KB
testcase_20 AC 5 ms
9,708 KB
testcase_21 AC 22 ms
10,048 KB
testcase_22 AC 119 ms
12,072 KB
testcase_23 AC 203 ms
14,316 KB
testcase_24 AC 42 ms
10,520 KB
testcase_25 AC 228 ms
15,360 KB
testcase_26 AC 347 ms
20,832 KB
testcase_27 AC 356 ms
21,364 KB
testcase_28 AC 339 ms
19,996 KB
testcase_29 AC 340 ms
19,124 KB
testcase_30 AC 349 ms
20,252 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<long long> 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(long long j:w[i]){
          s[x].push_back(j);
        }
      }
      if(i*i!=x&&w[x/i].size()){
        for(long long j:w[x/i]){
          s[x].push_back(j);
        }
      }
    }
  }
}
int main(){
  cin>>n;
  for(long long i=1;i<=n;i++){
    cin>>a[i];
    d[i]=1,w[a[i]].push_back(i);
    F(a[i]);
  }
  for(long long i=1;i<=n;i++){
    for(long long 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