結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 335 ms
18,376 KB
testcase_01 AC 304 ms
19,320 KB
testcase_02 AC 274 ms
19,020 KB
testcase_03 AC 369 ms
21,548 KB
testcase_04 AC 358 ms
22,544 KB
testcase_05 AC 31 ms
10,880 KB
testcase_06 AC 314 ms
14,804 KB
testcase_07 AC 349 ms
24,012 KB
testcase_08 AC 350 ms
24,080 KB
testcase_09 AC 31 ms
10,880 KB
testcase_10 AC 29 ms
10,880 KB
testcase_11 AC 55 ms
11,904 KB
testcase_12 AC 57 ms
11,776 KB
testcase_13 AC 58 ms
11,904 KB
testcase_14 AC 219 ms
17,392 KB
testcase_15 AC 354 ms
21,612 KB
testcase_16 AC 35 ms
11,008 KB
testcase_17 AC 283 ms
19,488 KB
testcase_18 AC 31 ms
10,752 KB
testcase_19 AC 269 ms
18,880 KB
testcase_20 AC 31 ms
10,752 KB
testcase_21 AC 32 ms
10,752 KB
testcase_22 AC 34 ms
10,880 KB
testcase_23 AC 31 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 in range(n):
            to=bisect.bisect_left(dp,a[i])
            dp[to]=a[i]
            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]=-A[i]
ans=max(ans,f(N,A))
print(ans)
0