結果

問題 No.1242 高橋君とすごろく
ユーザー abc3
提出日時 2020-10-02 23:18:32
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 954 bytes
コンパイル時間 1,908 ms
コンパイル使用メモリ 196,964 KB
最終ジャッジ日時 2025-01-15 01:19:21
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 19 WA * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <iomanip>
#include <cstdint>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const int INF=1001001001;
const int mod = 1000000007;
 
int main() {
  int64_t N,K;
  cin>>N>>K;
  vector<int64_t>A(K);
  for(int i=0;i<K;i++){
      cin>>A[i];
  }
  vector<bool>t(7,false);
  for(int i=K;i>=1;i--){
      if(A[i]==A[i-1]+1&&A[i]>=10){cout<<"No"<<endl;return 0;}
      if(A[i]==A[i-1]+5&&A[i]>=15){cout<<"No"<<endl;return 0;}
      if(A[i]==A[i-1]+3&&A[i]>=15){cout<<"No"<<endl;return 0;}
  }
  bool ok=true;
  for(int i=0;i<K;i++){
  if(A[i]==2&&A[i+1]==3){ok=false;}
  if(A[i]==3&&A[i+1]==4){ok=false;}
  if(A[i]==2&&A[i+1]==7){ok=false;}
  if(A[i]==2&&A[i+1]==5){ok=false;}
  }
  if(ok){cout<<"Yes"<<endl;}
  else{cout<<"No"<<endl;}
  return 0;
}
0