結果
| 問題 |
No.1188 レベルX門松列
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-08-25 09:49:43 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 364 ms / 2,000 ms |
| コード長 | 456 bytes |
| コンパイル時間 | 211 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 21,676 KB |
| 最終ジャッジ日時 | 2024-11-06 11:05:48 |
| 合計ジャッジ時間 | 6,077 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 |
ソースコード
import bisect
N=int(input())
A=list(map(int,input().split()))
def f(n,a):
ret=0
dp=[10**20]*n
L=[-1]*n
for i in range(n):
to=bisect.bisect_left(dp,a[i])
dp[to]=a[i]
L[i]=to
a=a[::-1]
dp=[10**20]*n
for i in range(n):
to=bisect.bisect_left(dp,a[i])
dp[to]=a[i]
ret=max(ret,min(L[n-1-i],to))
return ret
ans=f(N,A)
for i in range(N):
A[i]=-A[i]
ans=max(ans,f(N,A))
print(ans)