結果

問題 No.2218 Multiple LIS
ユーザー t98slidert98slider
提出日時 2023-02-17 21:33:36
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 77 ms / 3,000 ms
コード長 618 bytes
コンパイル時間 1,510 ms
コンパイル使用メモリ 168,836 KB
実行使用メモリ 14,320 KB
最終ジャッジ日時 2023-09-26 18:43:32
合計ジャッジ時間 5,897 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 55 ms
13,740 KB
testcase_01 AC 58 ms
13,856 KB
testcase_02 AC 55 ms
13,796 KB
testcase_03 AC 57 ms
13,848 KB
testcase_04 AC 55 ms
13,896 KB
testcase_05 AC 55 ms
13,856 KB
testcase_06 AC 58 ms
13,800 KB
testcase_07 AC 56 ms
14,064 KB
testcase_08 AC 54 ms
13,932 KB
testcase_09 AC 59 ms
13,836 KB
testcase_10 AC 55 ms
13,852 KB
testcase_11 AC 58 ms
13,796 KB
testcase_12 AC 53 ms
13,868 KB
testcase_13 AC 57 ms
13,936 KB
testcase_14 AC 59 ms
13,816 KB
testcase_15 AC 61 ms
13,740 KB
testcase_16 AC 58 ms
13,812 KB
testcase_17 AC 56 ms
13,860 KB
testcase_18 AC 56 ms
13,836 KB
testcase_19 AC 58 ms
13,908 KB
testcase_20 AC 55 ms
13,836 KB
testcase_21 AC 57 ms
13,800 KB
testcase_22 AC 59 ms
13,860 KB
testcase_23 AC 65 ms
14,192 KB
testcase_24 AC 58 ms
13,960 KB
testcase_25 AC 70 ms
14,120 KB
testcase_26 AC 74 ms
14,164 KB
testcase_27 AC 76 ms
14,064 KB
testcase_28 AC 73 ms
14,120 KB
testcase_29 AC 73 ms
14,168 KB
testcase_30 AC 77 ms
14,268 KB
testcase_31 AC 71 ms
14,264 KB
testcase_32 AC 77 ms
14,116 KB
testcase_33 AC 75 ms
14,320 KB
testcase_34 AC 73 ms
14,080 KB
testcase_35 AC 72 ms
14,128 KB
testcase_36 AC 70 ms
14,076 KB
testcase_37 AC 76 ms
14,152 KB
testcase_38 AC 61 ms
13,900 KB
testcase_39 AC 55 ms
13,856 KB
testcase_40 AC 71 ms
14,160 KB
testcase_41 AC 68 ms
14,068 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, m = 100000;
    cin >> n;
    vector<vector<int>> tb(m + 1);
    for(int i = 1; i <= m; i++){
        for(int j = i; j <= m; j += i){
            tb[j].push_back(i);
        }
    }
    vector<int> a(n);
    for(auto &&v:a)cin >> v;
    vector<int> dp(m + 1);
    for(int i = 0; i < n; i++){
        int mx = 0;
        for(auto &&v:tb[a[i]]){
            mx = max(mx, dp[v]);
        }
        dp[a[i]] = mx + 1;
    }
    cout << *max_element(dp.begin(), dp.end()) << '\n';
}
0