結果

問題 No.1188 レベルX門松列
ユーザー rlangevinrlangevin
提出日時 2023-01-11 22:15:08
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 450 bytes
コンパイル時間 298 ms
コンパイル使用メモリ 86,764 KB
実行使用メモリ 102,892 KB
最終ジャッジ日時 2023-08-24 03:02:28
合計ジャッジ時間 5,439 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 121 ms
101,304 KB
testcase_05 AC 74 ms
71,224 KB
testcase_06 AC 103 ms
95,060 KB
testcase_07 AC 116 ms
99,576 KB
testcase_08 AC 117 ms
99,416 KB
testcase_09 AC 72 ms
71,260 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 75 ms
71,232 KB
testcase_21 AC 73 ms
71,184 KB
testcase_22 AC 74 ms
71,412 KB
testcase_23 AC 75 ms
71,104 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
B = list(map(int, input().split()))
M, P = [0] * (N - 1), [0] * (N - 1)
for i in range(N - 1):
    if B[i] < B[i + 1]:
        P[i] = 1
    elif B[i] > B[i + 1]:
        M[i] = 1
Mc, Pc = [0] * N, [0] * N
for i in range(N - 1):
    Mc[i + 1] = Mc[i] + M[i]
    Pc[i + 1] = Pc[i] + P[i]
    
ans = 0
for i in range(N):
    v1 = min(Mc[i], Pc[N - 1] - Pc[i])
    v2 = min(Pc[i], Mc[N - 1] - Mc[i])
    ans = max(ans, v1, v2)
print(ans)
0