結果

問題 No.2836 Comment Out
ユーザー HIcoder
提出日時 2024-08-14 22:05:12
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 859 bytes
コンパイル時間 1,199 ms
コンパイル使用メモリ 115,424 KB
最終ジャッジ日時 2025-02-23 22:44:34
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 29 WA * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

/*
https://yukicoder.me/problems/no/2836
*/

#include<iostream>
#include<string>
#include<queue>
#include<vector>
#include<cassert>
#include<random>
#include<set>
#include<map>
#include<cassert>
#include<unordered_map>
#include<bitset>
#include<numeric>
#include<algorithm>
using namespace std;
typedef long long ll;
const int inf=1<<30;
const ll INF=1LL<<62;
typedef pair<int,ll> P;
typedef pair<int,P> PP; 
const ll MOD=998244353;

int main(){
    
    int N;
    cin>>N;
    vector<int> A(N);
    for(int i=0;i<N;i++){
        cin>>A[i];
    }

    bool ok=true;
    for(int i=1;i<N;i++){
        int d=abs(A[i]-A[i-1]);
        if(d<=1)continue;
        else ok=false;
    }

    if(ok){
        int v=*min_element(A.begin(),A.end());
        
        if(v<=1){
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    cout<<"No"<<endl;
}
0