結果

問題 No.2836 Comment Out
ユーザー qwewe
提出日時 2025-05-14 12:56:29
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 465 bytes
コンパイル時間 197 ms
コンパイル使用メモリ 82,820 KB
実行使用メモリ 102,684 KB
最終ジャッジ日時 2025-05-14 12:58:44
合計ジャッジ時間 6,627 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 26 WA * 26
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
a = list(map(int, input().split()))

if not a:
    print("Yes")
    exit()

max_a = max(a)
if max_a == 0:
    print("Yes")
    exit()

max_m = 0
for i in range(n):
    left = a[i-1] if i > 0 else 0
    right = a[i+1] if i < n-1 else 0
    max_neighbor = max(left, right)
    if max_neighbor < a[i]:
        current_m = min(a[i], max_neighbor + 1)
        if current_m > max_m:
            max_m = current_m

print("Yes" if max_m >= max_a else "No")
0