結果
| 問題 | No.1188 レベルX門松列 |
| コンテスト | |
| ユーザー |
👑 SPD_9X2
|
| 提出日時 | 2020-08-22 13:56:08 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 136 ms / 2,000 ms |
| コード長 | 909 bytes |
| 記録 | |
| コンパイル時間 | 322 ms |
| コンパイル使用メモリ | 85,508 KB |
| 実行使用メモリ | 96,604 KB |
| 最終ジャッジ日時 | 2026-05-03 23:44:26 |
| 合計ジャッジ時間 | 3,356 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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