結果

問題 No.2218 Multiple LIS
ユーザー shinchanshinchan
提出日時 2023-02-17 21:25:36
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 360 ms / 3,000 ms
コード長 826 bytes
コンパイル時間 2,292 ms
コンパイル使用メモリ 199,828 KB
実行使用メモリ 4,668 KB
最終ジャッジ日時 2023-09-26 18:30:32
合計ジャッジ時間 6,763 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 3 ms
4,376 KB
testcase_03 AC 3 ms
4,376 KB
testcase_04 AC 3 ms
4,384 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 3 ms
4,380 KB
testcase_07 AC 3 ms
4,380 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 3 ms
4,376 KB
testcase_11 AC 3 ms
4,380 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 3 ms
4,376 KB
testcase_15 AC 3 ms
4,376 KB
testcase_16 AC 2 ms
4,376 KB
testcase_17 AC 3 ms
4,376 KB
testcase_18 AC 2 ms
4,384 KB
testcase_19 AC 2 ms
4,380 KB
testcase_20 AC 3 ms
4,376 KB
testcase_21 AC 16 ms
4,376 KB
testcase_22 AC 92 ms
4,376 KB
testcase_23 AC 156 ms
4,412 KB
testcase_24 AC 34 ms
4,376 KB
testcase_25 AC 174 ms
4,400 KB
testcase_26 AC 251 ms
4,612 KB
testcase_27 AC 250 ms
4,664 KB
testcase_28 AC 247 ms
4,616 KB
testcase_29 AC 248 ms
4,568 KB
testcase_30 AC 247 ms
4,664 KB
testcase_31 AC 69 ms
4,660 KB
testcase_32 AC 68 ms
4,668 KB
testcase_33 AC 69 ms
4,640 KB
testcase_34 AC 68 ms
4,572 KB
testcase_35 AC 68 ms
4,552 KB
testcase_36 AC 10 ms
4,612 KB
testcase_37 AC 360 ms
4,620 KB
testcase_38 AC 2 ms
4,376 KB
testcase_39 AC 2 ms
4,376 KB
testcase_40 AC 293 ms
4,572 KB
testcase_41 AC 292 ms
4,568 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
#define rep(i, n) for(int i=0;i<n;i++)
#define all(i, v) for(auto& i : v)
typedef long long ll;
using namespace std;
const ll mod=1000000007, INF=(1LL<<60);
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;

int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin >> n;
    vector<ll> a(n);
    vector<ll> dp(100001, 0);
    rep(i, n) cin >> a[i];
    rep(i, n) {
        ll m = 0;
        for(ll j = 1; j * j <= a[i]; j ++) {
            if(a[i] % j == 0) {
                m = max(m, dp[j] + 1);
                m = max(m, dp[a[i]/j] + 1);
            }
        }
        dp[a[i]] = m;
    }
    ll ans = 0;
    all(e, dp) ans = max(ans, e);
    cout << ans << endl;

    return 0;
}
0