結果

問題 No.1188 レベルX門松列
ユーザー 37zigen37zigen
提出日時 2020-08-25 09:58:32
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 362 ms / 2,000 ms
コード長 455 bytes
コンパイル時間 297 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 24,004 KB
最終ジャッジ日時 2024-04-24 04:13:52
合計ジャッジ時間 5,501 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 333 ms
18,376 KB
testcase_01 AC 300 ms
19,316 KB
testcase_02 AC 268 ms
18,812 KB
testcase_03 AC 362 ms
21,548 KB
testcase_04 AC 357 ms
22,416 KB
testcase_05 AC 32 ms
10,624 KB
testcase_06 AC 309 ms
14,680 KB
testcase_07 AC 349 ms
24,004 KB
testcase_08 AC 351 ms
23,948 KB
testcase_09 AC 32 ms
10,624 KB
testcase_10 AC 30 ms
10,624 KB
testcase_11 AC 52 ms
11,776 KB
testcase_12 AC 54 ms
11,776 KB
testcase_13 AC 54 ms
11,776 KB
testcase_14 AC 214 ms
17,260 KB
testcase_15 AC 357 ms
21,612 KB
testcase_16 AC 33 ms
10,880 KB
testcase_17 AC 279 ms
19,100 KB
testcase_18 AC 29 ms
10,752 KB
testcase_19 AC 257 ms
18,748 KB
testcase_20 AC 30 ms
10,752 KB
testcase_21 AC 30 ms
10,752 KB
testcase_22 AC 30 ms
10,752 KB
testcase_23 AC 32 ms
10,880 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import bisect
N=int(input())
A=list(map(int,input().split()))
def f(n,a):
    ret=0
    def g(n,a):
        dp=[10**20]*n
        A=[0]*n
        for i,a in enumerate(a):
            to=bisect.bisect_left(dp,a)
            dp[to]=a
            A[i]=to
        return A
    L=g(n,a)
    R=g(n,a[::-1])[::-1]
    for i in range(n):
        ret=max(ret,min(L[i],R[i]))
    return ret

ans=f(N,A)
for i in range(N):
    A[i]*=-1
ans=max(ans,f(N,A))
print(ans)
0