結果
問題 | No.2218 Multiple LIS |
ユーザー |
![]() |
提出日時 | 2023-02-17 22:00:04 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 1,289 bytes |
コンパイル時間 | 2,167 ms |
コンパイル使用メモリ | 203,772 KB |
実行使用メモリ | 13,696 KB |
最終ジャッジ日時 | 2023-09-26 19:17:24 |
合計ジャッジ時間 | 14,306 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | RE | - |
testcase_01 | RE | - |
testcase_02 | RE | - |
testcase_03 | RE | - |
testcase_04 | RE | - |
testcase_05 | RE | - |
testcase_06 | RE | - |
testcase_07 | RE | - |
testcase_08 | RE | - |
testcase_09 | RE | - |
testcase_10 | RE | - |
testcase_11 | RE | - |
testcase_12 | RE | - |
testcase_13 | RE | - |
testcase_14 | RE | - |
testcase_15 | RE | - |
testcase_16 | RE | - |
testcase_17 | RE | - |
testcase_18 | RE | - |
testcase_19 | RE | - |
testcase_20 | RE | - |
testcase_21 | AC | 6 ms
5,804 KB |
testcase_22 | AC | 24 ms
7,108 KB |
testcase_23 | AC | 40 ms
7,684 KB |
testcase_24 | AC | 10 ms
5,912 KB |
testcase_25 | AC | 44 ms
8,280 KB |
testcase_26 | AC | 65 ms
9,080 KB |
testcase_27 | AC | 66 ms
9,172 KB |
testcase_28 | AC | 63 ms
9,004 KB |
testcase_29 | AC | 65 ms
9,164 KB |
testcase_30 | AC | 64 ms
9,024 KB |
testcase_31 | AC | 624 ms
8,096 KB |
testcase_32 | AC | 613 ms
8,316 KB |
testcase_33 | AC | 616 ms
8,028 KB |
testcase_34 | AC | 615 ms
8,112 KB |
testcase_35 | AC | 627 ms
7,980 KB |
testcase_36 | TLE | - |
testcase_37 | -- | - |
testcase_38 | -- | - |
testcase_39 | -- | - |
testcase_40 | -- | - |
testcase_41 | -- | - |
ソースコード
#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); ll mx=0; rep(i,n){ cin >> a[i]; chmax(mx,a[i]); b[a[i]].push_back(i); } vector<ll> dp(n,1); rep(i,n){ if(200<=a[i]){ for(ll j=a[i];j<=mx;j+=a[i]){ auto itr=upper_bound(all(b[j]),i); if(itr==b[j].end()) continue; chmax(dp[(*itr)],dp[i]+1); } } for(ll j=a[i];j<=1e4;j+=a[i]){ auto itr=upper_bound(all(b[j]),i); if(itr==b[j].end()) continue; chmax(dp[(*itr)],dp[i]+1); } for(ll j=(mx+a[i]-1)/a[i];mx-1e4<=j;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; }