結果

問題 No.2836 Comment Out
ユーザー gew1fw
提出日時 2025-06-12 15:18:13
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 619 bytes
コンパイル時間 165 ms
コンパイル使用メモリ 82,192 KB
実行使用メモリ 102,644 KB
最終ジャッジ日時 2025-06-12 15:18:21
合計ジャッジ時間 6,198 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 28 WA * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

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

if n == 1:
    print("Yes")
else:
    # Check if all elements are the same and greater than 1
    all_same = True
    first = a[0]
    for num in a[1:]:
        if num != first:
            all_same = False
            break
    if all_same and first > 1:
        print("No")
    else:
        # Check if for any i, a[i] > a[i+1] + 1
        impossible = False
        for i in range(n-1):
            if a[i] > a[i+1] + 1:
                impossible = True
                break
        if impossible:
            print("No")
        else:
            print("Yes")
0