結果

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

ソースコード

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);
  set<int64_t>over;
  for(int i=0;i<K;i++){
      cin>>A[i];
      over.insert(A[i]);
  }
  for(int i=0;i<K;i++){
      if(over.count(A[i]+5)&&A[i]>=10){cout<<"No"<<endl;return 0;}
      if(over.count(A[i]+3)&&A[i]>=10){cout<<"No"<<endl;return 0;}
      if(over.count(A[i]+1)&&A[i]>=10){cout<<"No"<<endl;return 0;}//新たにオーバーマスができるとそれ以降に必ずxxがあるのでそれが大きい場所にあると全部xに収束する.多めに10回くらいにする。
  }
  for(int d=10;d>=0;d--){
      if(over.count(d+1)&&over.count(d+6)){over.insert(d);}
      if(over.count(d+2)&&over.count(d+5)){over.insert(d);}
      if(over.count(d+3)&&over.count(d+4)){over.insert(d);}
  }
  bool ok=true;
  if(over.count(1)){ok=false;}
  if(ok){cout<<"Yes"<<endl;}
  else{cout<<"No"<<endl;}
  return 0;
}
0