結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 340 ms
18,484 KB
testcase_01 AC 308 ms
19,196 KB
testcase_02 AC 278 ms
18,300 KB
testcase_03 AC 370 ms
21,548 KB
testcase_04 AC 364 ms
21,020 KB
testcase_05 AC 31 ms
10,752 KB
testcase_06 AC 322 ms
14,672 KB
testcase_07 AC 353 ms
21,008 KB
testcase_08 AC 353 ms
20,800 KB
testcase_09 AC 32 ms
10,752 KB
testcase_10 AC 30 ms
10,752 KB
testcase_11 AC 55 ms
11,648 KB
testcase_12 AC 57 ms
11,648 KB
testcase_13 AC 60 ms
12,032 KB
testcase_14 AC 223 ms
17,268 KB
testcase_15 AC 365 ms
21,612 KB
testcase_16 AC 33 ms
10,752 KB
testcase_17 AC 294 ms
19,360 KB
testcase_18 AC 31 ms
10,624 KB
testcase_19 AC 272 ms
18,880 KB
testcase_20 AC 31 ms
10,624 KB
testcase_21 AC 32 ms
10,752 KB
testcase_22 AC 31 ms
10,624 KB
testcase_23 AC 31 ms
10,624 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

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