結果

問題 No.2218 Multiple LIS
ユーザー FplusFplusFFplusFplusF
提出日時 2023-02-17 21:55:33
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 831 bytes
コンパイル時間 2,055 ms
コンパイル使用メモリ 204,496 KB
実行使用メモリ 9,192 KB
最終ジャッジ日時 2023-09-26 19:13:10
合計ジャッジ時間 22,659 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
5,424 KB
testcase_01 AC 3 ms
5,428 KB
testcase_02 AC 5 ms
5,356 KB
testcase_03 AC 4 ms
5,540 KB
testcase_04 AC 4 ms
5,404 KB
testcase_05 AC 4 ms
5,420 KB
testcase_06 AC 4 ms
5,536 KB
testcase_07 AC 4 ms
5,536 KB
testcase_08 AC 4 ms
5,308 KB
testcase_09 AC 4 ms
5,524 KB
testcase_10 AC 4 ms
5,420 KB
testcase_11 AC 4 ms
5,496 KB
testcase_12 AC 8 ms
5,524 KB
testcase_13 AC 14 ms
5,372 KB
testcase_14 AC 11 ms
5,528 KB
testcase_15 AC 11 ms
5,492 KB
testcase_16 AC 6 ms
5,524 KB
testcase_17 AC 15 ms
5,684 KB
testcase_18 AC 4 ms
5,532 KB
testcase_19 AC 6 ms
5,356 KB
testcase_20 AC 13 ms
5,488 KB
testcase_21 AC 6 ms
5,692 KB
testcase_22 AC 24 ms
6,936 KB
testcase_23 AC 40 ms
7,816 KB
testcase_24 AC 11 ms
5,888 KB
testcase_25 AC 47 ms
8,000 KB
testcase_26 AC 71 ms
9,060 KB
testcase_27 AC 75 ms
9,192 KB
testcase_28 AC 72 ms
9,184 KB
testcase_29 AC 65 ms
9,168 KB
testcase_30 AC 72 ms
9,072 KB
testcase_31 AC 2,527 ms
8,104 KB
testcase_32 AC 2,548 ms
8,128 KB
testcase_33 AC 2,582 ms
8,160 KB
testcase_34 AC 2,488 ms
8,076 KB
testcase_35 AC 2,529 ms
8,044 KB
testcase_36 TLE -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (long long i=0;i<(long long)(n);i++)
#define all(v) v.begin(),v.end()
using ll=long long;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll,ll>;
const ll INF=(1ll<<60);
template<class T> void chmin(T &a,T b){
    if(a>b){
        a=b;
    }
}
template<class T> void chmax(T &a,T b){
    if(a<b){
        a=b;
    }
}
int main(){
    ll n;
    cin >> n;
    vector<ll> a(n);
    vector<vector<ll>> b(1e5+1);
    rep(i,n){
        cin >> a[i];
        b[a[i]].push_back(i);
    }
    vector<ll> dp(n,1);
    rep(i,n){
        for(ll j=a[i];j<=1e5;j+=a[i]){
            auto itr=upper_bound(all(b[j]),i);
            if(itr==b[j].end()) continue;
            chmax(dp[(*itr)],dp[i]+1);
        }
    }
    ll ans=1;
    rep(i,n) chmax(ans,dp[i]);
    cout << ans << endl;
}
0