結果
| 問題 | 
                            No.127 門松もどき
                             | 
                    
| コンテスト | |
| ユーザー | 
                             maspy
                         | 
                    
| 提出日時 | 2020-04-09 00:12:52 | 
| 言語 | Python3  (3.13.1 + numpy 2.2.1 + scipy 1.14.1)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 533 ms / 5,000 ms | 
| コード長 | 617 bytes | 
| コンパイル時間 | 95 ms | 
| コンパイル使用メモリ | 12,416 KB | 
| 実行使用メモリ | 44,604 KB | 
| 最終ジャッジ日時 | 2024-07-19 05:55:59 | 
| 合計ジャッジ時間 | 14,545 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 23 | 
ソースコード
#!/usr/bin/ python3.8
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np
N = int(readline())
A = np.array(read().split(), np.int32)
# 長さ 1
dpl = np.ones(N, np.int32)
dpr = np.ones(N, np.int32)
answer = 1
for n in range(2, N + 1):
    x = dpl[:-1]
    y = (1 + dpr[1:]) * (A[0: N - n + 1] < A[n - 1:N])
    newdpl = np.maximum(x, y)
    x = dpr[1:]
    y = (1 + dpl[:-1]) * (A[n - 1:N] < A[0: N - n + 1])
    newdpr = np.maximum(x, y)
    dpl, dpr = newdpl, newdpr
    answer = max(answer, dpl.max(), dpr.max())
print(answer)
            
            
            
        
            
maspy