結果

問題 No.2218 Multiple LIS
ユーザー kcvlexkcvlex
提出日時 2023-02-17 22:11:44
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 103 ms / 3,000 ms
コード長 749 bytes
コンパイル時間 3,014 ms
コンパイル使用メモリ 138,732 KB
実行使用メモリ 14,420 KB
最終ジャッジ日時 2023-09-26 19:27:01
合計ジャッジ時間 7,771 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
13,780 KB
testcase_01 AC 62 ms
13,896 KB
testcase_02 AC 63 ms
13,952 KB
testcase_03 AC 62 ms
13,848 KB
testcase_04 AC 56 ms
13,828 KB
testcase_05 AC 59 ms
13,908 KB
testcase_06 AC 56 ms
13,816 KB
testcase_07 AC 59 ms
13,896 KB
testcase_08 AC 58 ms
13,892 KB
testcase_09 AC 60 ms
13,952 KB
testcase_10 AC 54 ms
14,096 KB
testcase_11 AC 55 ms
14,016 KB
testcase_12 AC 55 ms
14,108 KB
testcase_13 AC 59 ms
13,880 KB
testcase_14 AC 58 ms
13,856 KB
testcase_15 AC 59 ms
13,876 KB
testcase_16 AC 59 ms
13,876 KB
testcase_17 AC 59 ms
13,832 KB
testcase_18 AC 58 ms
13,852 KB
testcase_19 AC 57 ms
13,820 KB
testcase_20 AC 58 ms
13,856 KB
testcase_21 AC 63 ms
13,952 KB
testcase_22 AC 73 ms
13,900 KB
testcase_23 AC 88 ms
14,116 KB
testcase_24 AC 67 ms
13,948 KB
testcase_25 AC 91 ms
14,100 KB
testcase_26 AC 100 ms
14,152 KB
testcase_27 AC 100 ms
14,228 KB
testcase_28 AC 94 ms
14,072 KB
testcase_29 AC 94 ms
14,236 KB
testcase_30 AC 94 ms
14,116 KB
testcase_31 AC 83 ms
14,148 KB
testcase_32 AC 87 ms
14,212 KB
testcase_33 AC 88 ms
14,412 KB
testcase_34 AC 86 ms
14,096 KB
testcase_35 AC 88 ms
14,188 KB
testcase_36 AC 82 ms
14,216 KB
testcase_37 AC 103 ms
14,104 KB
testcase_38 AC 57 ms
13,880 KB
testcase_39 AC 59 ms
13,948 KB
testcase_40 AC 86 ms
14,420 KB
testcase_41 AC 86 ms
14,108 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <atcoder/all>

#define ALL(V) std::begin(V), std::end(V)

const int SIZE = 1e5 + 10;

template <typename T>
void chmax(T &a, const T &b) { a = std::max(a, b); }

int main() {
    std::vector<std::vector<int>> divs(SIZE);
    for (int i = 1; i < SIZE; i++) {
        for (int j = 1; i * j < SIZE; j++) {
            divs[i * j].push_back(i);
        }
    }
    int N;
    std::cin >> N;
    std::vector<int> A(N);
    for (auto &e : A) std::cin >> e;
    std::vector<int> dp(SIZE);
    for (auto e : A) {
        int v = 0;
        for (auto d : divs[e]) chmax(v, dp[d] + 1);
        chmax(dp[e], v);
    }
    std::cout << *std::max_element(ALL(dp)) << std::endl;
    return 0;
}
0