結果
| 問題 |
No.1188 レベルX門松列
|
| コンテスト | |
| ユーザー |
tyawanmusi
|
| 提出日時 | 2020-08-22 17:55:34 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 450 bytes |
| コンパイル時間 | 258 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 21,484 KB |
| 最終ジャッジ日時 | 2024-10-15 11:47:44 |
| 合計ジャッジ時間 | 5,641 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 5 WA * 16 |
ソースコード
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)
tyawanmusi