結果

問題 No.1188 レベルX門松列
ユーザー qumazaki
提出日時 2020-09-12 02:55:28
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 186 ms / 2,000 ms
コード長 515 bytes
コンパイル時間 290 ms
コンパイル使用メモリ 82,396 KB
実行使用メモリ 95,936 KB
最終ジャッジ日時 2024-12-29 16:54:50
合計ジャッジ時間 4,752 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

import bisect

n = int(input())
a = list(map(int,input().split()))

inc_l = [0] * n
inc_r = [0] * n
dec_l = [0] * n
dec_r = [0] * n

for x,pm,cnt in zip([a,a,a[::-1],a[::-1]],[1,-1,1,-1],[inc_l,dec_l,inc_r,dec_r]):
    lis = [10**10] * n
    for i,xi in enumerate(x):
        xi *= pm
        ind = bisect.bisect_left(lis,xi)
        cnt[i] = ind
        lis[ind] = xi

inc_r = inc_r[::-1]
dec_r = dec_r[::-1]

ans = 0
for i in range(n):
    ans = max(ans, min(inc_l[i],inc_r[i]), min(dec_l[i],dec_r[i]))
print(ans)
0