結果

問題 No.1188 レベルX門松列
ユーザー marroncastlemarroncastle
提出日時 2020-08-23 21:58:20
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 569 bytes
コンパイル時間 161 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 27,652 KB
最終ジャッジ日時 2024-04-23 18:36:08
合計ジャッジ時間 4,855 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 272 ms
23,136 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 353 ms
27,588 KB
testcase_05 AC 26 ms
10,752 KB
testcase_06 WA -
testcase_07 AC 304 ms
24,400 KB
testcase_08 AC 306 ms
27,652 KB
testcase_09 AC 27 ms
10,752 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 48 ms
11,904 KB
testcase_13 AC 47 ms
11,904 KB
testcase_14 WA -
testcase_15 AC 312 ms
25,752 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 28 ms
10,752 KB
testcase_21 AC 26 ms
10,752 KB
testcase_22 AC 26 ms
10,752 KB
testcase_23 AC 27 ms
10,624 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from bisect import bisect_left
N = int(input())
A = list(map(int, input().split()))
def LIS(A,N):
    lis = []
    ans = [0]*N
    for i in range(N):
        ans[i] = len(lis)
        ind = bisect_left(lis,A[i])
        if ind == len(lis):
            lis.append(A[i])
        else:
            lis[ind] = A[i]
    return ans
def kadomatsu(A,N):
    lis1 = LIS(A,N)
    lis2 = LIS(A[::-1],N)[::-1]
    ans = 0
    for i in range(N):
        ans = max(ans, min(lis1[i],lis2[i]))
    return ans
a = kadomatsu(A,N)
b = kadomatsu(list(map(lambda x:-x,A)),N)
print(max(a,b))
0