結果

問題 No.1188 レベルX門松列
ユーザー ShibuyapShibuyap
提出日時 2020-08-22 15:29:36
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 999 bytes
コンパイル時間 2,278 ms
コンパイル使用メモリ 194,748 KB
実行使用メモリ 12,196 KB
最終ジャッジ日時 2024-04-23 09:47:30
合計ジャッジ時間 3,710 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
5,248 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 50 ms
5,376 KB
testcase_04 AC 43 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 23 ms
5,376 KB
testcase_07 WA -
testcase_08 AC 44 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 7 ms
5,376 KB
testcase_12 AC 5 ms
5,376 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 3 ms
5,376 KB
testcase_17 AC 47 ms
5,376 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
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 < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
using namespace std;
typedef pair<int,int> P;
typedef long long int ll;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}

const int MAX_N = 1001001;
const int INF = 1001001001;
int n;
int a[MAX_N];
int dp[MAX_N];
int l[MAX_N], r[MAX_N];

int main() {
    cin >> n;
    rep(i,n){
        cin >> a[i];
    }

    fill(dp, dp+n, 0);
    drep(i,n){
        auto ite = lower_bound(dp, dp+n, a[i]+1);
        r[i] = n - (ite - dp);
        ite--;
        *ite = a[i];
    }
    rep(i,n)dp[i] = 0;
    rep(i,n){
        auto ite = lower_bound(dp, dp+n, a[i]+1);
        l[i] = n - (ite - dp);
        ite--;
        *ite = a[i];
    }
    int ans = 0;
    rep(i,n){
        ans = max(ans,min(l[i],r[i]));
    }
    cout << ans << endl;
    return 0;
}
 
 

0