結果

問題 No.2218 Multiple LIS
ユーザー vjudge1vjudge1
提出日時 2023-08-29 10:56:53
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 728 bytes
コンパイル時間 2,774 ms
コンパイル使用メモリ 245,096 KB
実行使用メモリ 8,752 KB
最終ジャッジ日時 2023-08-29 10:57:18
合計ジャッジ時間 22,962 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 3 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 3 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 3 ms
4,380 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 3 ms
4,376 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 3 ms
4,380 KB
testcase_11 AC 3 ms
4,376 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 3 ms
4,380 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 2 ms
4,376 KB
testcase_18 AC 2 ms
4,376 KB
testcase_19 AC 3 ms
4,376 KB
testcase_20 AC 2 ms
4,376 KB
testcase_21 AC 11 ms
5,892 KB
testcase_22 AC 47 ms
6,940 KB
testcase_23 AC 79 ms
7,656 KB
testcase_24 AC 19 ms
6,264 KB
testcase_25 AC 88 ms
7,820 KB
testcase_26 AC 127 ms
8,432 KB
testcase_27 AC 127 ms
8,544 KB
testcase_28 AC 125 ms
8,584 KB
testcase_29 AC 128 ms
8,720 KB
testcase_30 AC 129 ms
8,436 KB
testcase_31 AC 2,734 ms
4,596 KB
testcase_32 AC 2,711 ms
4,664 KB
testcase_33 AC 2,681 ms
4,600 KB
testcase_34 AC 2,652 ms
4,604 KB
testcase_35 AC 2,755 ms
4,660 KB
testcase_36 TLE -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;
using LL = long long;

const int MAXN = 1e5 + 3;

int n;
int a[MAXN];
int dp[MAXN];
vector<int> s[MAXN];

int main(){
  ios::sync_with_stdio(0), cin.tie(0);
  cin >> n;
  for(int i = 1; i <= n; i++){
    cin >> a[i], dp[i] = 1;
    s[a[i]].push_back(i);
  }
  int ans = 0;
  for(int i = n; i >= 1; i--){
    s[a[i]].pop_back();
    for(int j = 1; j * j <= a[i]; j++){
      if(a[i] % j == 0){
        for(int id : s[j]){
          dp[id] = max(dp[id], dp[i] + 1);
        }
        if(a[i] / j != j){
          for(int id : s[a[i] / j]){
            dp[id] = max(dp[id], dp[i] + 1);
          }
        }
      }
    }
    ans = max(ans, dp[i]);
  }
  cout << ans;
  return 0;//
}
0