結果

問題 No.1188 レベルX門松列
ユーザー kappybarkappybar
提出日時 2020-08-23 17:51:20
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 50 ms / 2,000 ms
コード長 1,046 bytes
コンパイル時間 1,676 ms
コンパイル使用メモリ 166,008 KB
実行使用メモリ 5,848 KB
最終ジャッジ日時 2024-04-23 18:10:32
合計ジャッジ時間 3,165 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 25 ms
5,848 KB
testcase_01 AC 42 ms
5,456 KB
testcase_02 AC 37 ms
5,376 KB
testcase_03 AC 50 ms
5,732 KB
testcase_04 AC 50 ms
5,712 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 23 ms
5,728 KB
testcase_07 AC 45 ms
5,736 KB
testcase_08 AC 45 ms
5,732 KB
testcase_09 AC 1 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 5 ms
5,376 KB
testcase_12 AC 5 ms
5,376 KB
testcase_13 AC 6 ms
5,376 KB
testcase_14 AC 31 ms
5,376 KB
testcase_15 AC 50 ms
5,716 KB
testcase_16 AC 3 ms
5,376 KB
testcase_17 AC 41 ms
5,376 KB
testcase_18 AC 2 ms
5,376 KB
testcase_19 AC 38 ms
5,376 KB
testcase_20 AC 2 ms
5,376 KB
testcase_21 AC 2 ms
5,376 KB
testcase_22 AC 2 ms
5,376 KB
testcase_23 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
using ll = long long ;
using P = pair<int,int> ;
using pll = pair<long long,long long>;
constexpr int INF = 1e9+100;
constexpr long long LINF = 1e17;
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979323846;
int n;
int a[100005];

vector<int> lis(){
    vector<int> res(n);
    vector<int> lis(n,INF);
    rep(i,n){
        *lower_bound(lis.begin(),lis.end(),a[i]) = a[i];
        res[i]=lower_bound(lis.begin(),lis.end(),INF)-lis.begin();
    }
    return res;
}

int main(){
    scanf("%d",&n);
    rep(i,n) scanf("%d",&a[i]);
    int ans = 0;
    vector<int> b1 = lis();
    reverse(a,a+n);
    vector<int> b2 = lis();
    rep(i,n) a[i]*=-1;
    vector<int> c2 = lis();
    reverse(a,a+n);
    vector<int> c1 = lis();
    reverse(b2.begin(),b2.end());
    reverse(c2.begin(),c2.end());
    rep(i,n){
        ans = max(ans,min(b1[i],b2[i])-1);
        ans = max(ans,min(c1[i],c2[i])-1);
    }
    cout << ans << endl;
    return 0;
}
0