結果

問題 No.1188 レベルX門松列
ユーザー tyawanmusityawanmusi
提出日時 2020-08-22 17:55:34
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 450 bytes
コンパイル時間 93 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 21,612 KB
最終ジャッジ日時 2024-04-23 11:48:52
合計ジャッジ時間 5,965 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 358 ms
17,676 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 336 ms
13,904 KB
testcase_07 AC 394 ms
20,904 KB
testcase_08 AC 393 ms
20,780 KB
testcase_09 AC 31 ms
10,752 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 31 ms
10,752 KB
testcase_21 AC 30 ms
10,752 KB
testcase_22 AC 33 ms
10,880 KB
testcase_23 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

from bisect import bisect_left
def solve(n,a):
  ans=0
  dp_back=[10**20]*n
  b=[]
  for i in a[::-1]:
    dp_back[bisect_left(dp_back,i)]=i
    b.append(bisect_left(dp_back,10**20))
  b=b[::-1]
  dp=[10**20]*n
  for i in range(n):
    dp[bisect_left(dp,a[i])]=a[i]
    ans=max(ans,b[i],bisect_left(dp,10**20))
  return ans
n=int(input())
a=list(map(int,input().split()))
ans=solve(n,a)
for i in range(n):a[i]*=-1
ans=max(ans,solve(n,a))
print(ans-1)
0