結果
| 問題 | No.1188 レベルX門松列 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-08-22 17:55:34 |
| 言語 | Python3 (3.15.0 + numpy 2.5.4 + scipy 1.18.1 + ACL) |
| 結果 |
WA
不安定
|
| 実行時間 | - |
| コード長 | 450 bytes |
| 記録 | |
| コンパイル時間 | 56 ms |
| コンパイル使用メモリ | 15,104 KB |
| 実行使用メモリ | 21,804 KB |
| 最終ジャッジ日時 | 2026-09-18 06:14:04 |
| 合計ジャッジ時間 | 4,545 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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)