結果

問題 No.1188 レベルX門松列
ユーザー rlangevinrlangevin
提出日時 2023-01-17 23:44:35
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 647 bytes
コンパイル時間 287 ms
コンパイル使用メモリ 87,288 KB
実行使用メモリ 98,848 KB
最終ジャッジ日時 2023-09-01 03:22:24
合計ジャッジ時間 6,191 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 205 ms
94,304 KB
testcase_05 AC 67 ms
71,168 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 67 ms
71,432 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 118 ms
78,436 KB
testcase_14 WA -
testcase_15 AC 225 ms
91,808 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 67 ms
71,324 KB
testcase_21 AC 67 ms
71,600 KB
testcase_22 AC 66 ms
71,564 KB
testcase_23 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

from bisect import *

def LIS(A):
    # weakly increase --> bisect_right
    # strictly increase --> bisect_left
    data = []
    L = [0]
    for i in range(N):
        ind = bisect_right(data, A[i])
        if len(data) == ind:
            data.append(A[i])
        else:
            data[ind] = A[i]
        L.append(len(data))
    return L


N = int(input())
A = list(map(int, input().split()))
LU = LIS(A)
A.reverse()
RU = LIS(A)
A = list(map(lambda x : -x, A))
RD = LIS(A)
A.reverse()
LD = LIS(A)

RU.reverse()
RD.reverse()
ans = 0
for i in range(N + 1):
    ans = max(ans, min(LU[i], RU[i]))
    ans = max(ans, min(LD[i], RD[i]))
print(ans)
0