結果
| 問題 |
No.1188 レベルX門松列
|
| コンテスト | |
| ユーザー |
👑 SPD_9X2
|
| 提出日時 | 2020-08-22 13:56:08 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 214 ms / 2,000 ms |
| コード長 | 909 bytes |
| コンパイル時間 | 171 ms |
| コンパイル使用メモリ | 82,432 KB |
| 実行使用メモリ | 92,676 KB |
| 最終ジャッジ日時 | 2024-10-15 08:13:29 |
| 合計ジャッジ時間 | 4,417 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 |
ソースコード
"""
ある要素を左端とする最長部分増加列と、右端とするを求める
→それのmin*2+1
"""
from sys import stdin
import sys
import bisect
def LIS(lis,tmp):
seq = []
for c in lis:
ind = bisect.bisect_left(seq,c)
tmp.append(ind)
if ind == len(seq):
seq.append(c)
else:
seq[ind] = c
return len(seq)
N = int(stdin.readline())
A = list(map(int,stdin.readline().split()))
ans = 0
LI = []
LIS(A,LI)
print (LI,file=sys.stderr)
A.reverse()
RI = []
LIS(A,RI)
RI.reverse()
A.reverse()
print (RI,file=sys.stderr)
for i in range(N):
ans = max( ans , min(LI[i] , RI[i]) )
for i in range(N):
A[i] *= -1
LI = []
LIS(A,LI)
print (LI,file=sys.stderr)
A.reverse()
RI = []
LIS(A,RI)
RI.reverse()
A.reverse()
print (RI,file=sys.stderr)
for i in range(N):
ans = max( ans , min(LI[i] , RI[i]) )
print (ans)
SPD_9X2