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