結果
| 問題 |
No.127 門松もどき
|
| コンテスト | |
| ユーザー |
maspy
|
| 提出日時 | 2020-04-09 00:12:20 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 617 bytes |
| コンパイル時間 | 111 ms |
| コンパイル使用メモリ | 12,416 KB |
| 実行使用メモリ | 44,600 KB |
| 最終ジャッジ日時 | 2024-07-19 05:55:41 |
| 合計ジャッジ時間 | 16,458 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 22 WA * 1 |
ソースコード
#!/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 = 0
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