結果

問題 No.2836 Comment Out
ユーザー tanaka255
提出日時 2024-08-09 21:45:37
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 751 bytes
コンパイル時間 1,728 ms
コンパイル使用メモリ 193,144 KB
最終ジャッジ日時 2025-02-23 21:29:53
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 29 WA * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
template<typename T>
bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template<typename T>
bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
void solve();
int main() {
  cin.tie(nullptr)->sync_with_stdio(false);
  cout << fixed << setprecision(20);
  int t = 1;
  //cin >> t;
  while (t--) {
    solve();
  }
}
int N;
void solve() {
  cin>>N;
  int prev=0;
  rep(i,N){
    int A;cin>>A;
    if(1<abs(A-prev)){
      cout<<"No"<<endl;
      return;
    }
    prev=A;
  }
  if(1<abs(0-prev)){
    cout<<"No"<<endl;
    return;
  }
  cout<<"Yes"<<endl;
}
0