結果

問題 No.1188 レベルX門松列
ユーザー qumazakiqumazaki
提出日時 2020-09-12 02:55:28
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 209 ms / 2,000 ms
コード長 515 bytes
コンパイル時間 274 ms
コンパイル使用メモリ 86,792 KB
実行使用メモリ 97,492 KB
最終ジャッジ日時 2023-08-28 14:53:30
合計ジャッジ時間 5,770 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 174 ms
96,224 KB
testcase_01 AC 188 ms
93,544 KB
testcase_02 AC 207 ms
91,828 KB
testcase_03 AC 209 ms
96,664 KB
testcase_04 AC 203 ms
96,712 KB
testcase_05 AC 70 ms
71,372 KB
testcase_06 AC 155 ms
94,984 KB
testcase_07 AC 203 ms
96,116 KB
testcase_08 AC 206 ms
96,124 KB
testcase_09 AC 71 ms
71,328 KB
testcase_10 AC 73 ms
71,360 KB
testcase_11 AC 104 ms
78,276 KB
testcase_12 AC 106 ms
78,488 KB
testcase_13 AC 107 ms
78,652 KB
testcase_14 AC 163 ms
88,312 KB
testcase_15 AC 208 ms
97,492 KB
testcase_16 AC 93 ms
77,264 KB
testcase_17 AC 183 ms
92,148 KB
testcase_18 AC 70 ms
71,440 KB
testcase_19 AC 179 ms
91,784 KB
testcase_20 AC 69 ms
71,212 KB
testcase_21 AC 71 ms
71,212 KB
testcase_22 AC 69 ms
71,432 KB
testcase_23 AC 69 ms
71,372 KB
権限があれば一括ダウンロードができます

ソースコード

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