結果

問題 No.1242 高橋君とすごろく
ユーザー poohbearpoohbear
提出日時 2020-10-02 22:39:54
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 48 ms / 2,000 ms
コード長 2,624 bytes
コンパイル時間 2,276 ms
コンパイル使用メモリ 203,360 KB
実行使用メモリ 4,568 KB
最終ジャッジ日時 2023-09-27 08:42:45
合計ジャッジ時間 4,424 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 47 ms
4,380 KB
testcase_01 AC 47 ms
4,380 KB
testcase_02 AC 47 ms
4,396 KB
testcase_03 AC 47 ms
4,408 KB
testcase_04 AC 47 ms
4,504 KB
testcase_05 AC 47 ms
4,384 KB
testcase_06 AC 47 ms
4,392 KB
testcase_07 AC 47 ms
4,376 KB
testcase_08 AC 48 ms
4,404 KB
testcase_09 AC 47 ms
4,416 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 47 ms
4,380 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 47 ms
4,396 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 47 ms
4,380 KB
testcase_16 AC 46 ms
4,380 KB
testcase_17 AC 47 ms
4,380 KB
testcase_18 AC 47 ms
4,568 KB
testcase_19 AC 47 ms
4,416 KB
testcase_20 AC 47 ms
4,508 KB
testcase_21 AC 46 ms
4,508 KB
testcase_22 AC 47 ms
4,388 KB
testcase_23 AC 47 ms
4,400 KB
testcase_24 AC 46 ms
4,376 KB
testcase_25 AC 47 ms
4,400 KB
testcase_26 AC 2 ms
4,380 KB
testcase_27 AC 47 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(a,n) for (ll a = 0; a < (n); ++a)
using namespace std;
//using namespace atcoder;
using ll = long long;
typedef pair<ll,ll> P;
typedef pair<ll,P> PP;
typedef vector<vector<int> > Graph;
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 ll INF = 1e18;

#define debug(v) cout<<#v<<": ",prt(v);
template <typename A,typename B>
inline void prt(pair<A,B> p){cout<<"("<<p.first<<", "<<p.second<<")\n";}
template <typename A,typename B,typename C>
inline void prt(tuple<A,B,C> p){cout<<"("<<get<0>(p)<<", "<<get<1>(p)<<", "<<get<2>(p)<<")\n";}
inline void prt(bool p){if(p)cout<<"True"<<'\n';else cout<<"False"<<'\n';}
template <typename T> 
inline void prt(vector<T> v){cout<<'{';for(ll i=0;i<v.size();i++){cout<<v[i];if(i<v.size()-1)cout<<", ";}cout<<'}'<<'\n';}
template<typename T> 
inline void prt(vector<vector<T> >& vv){ for(const auto& v : vv){ prt(v); } }
template <typename T> 
inline void prt(deque<T> v){cout<<'{';for(ll i=0;i<v.size();i++){cout<<v[i];if(i<v.size()-1)cout<<", ";}cout<<'}'<<'\n';}
template <typename A,typename B>
inline void prt(map<A,B> v){cout<<'{';ll c=0;for(auto &p: v){cout<<p.first<<":"<<p.second;c++;if(c!=v.size())cout<<", ";}cout<<'}'<<'\n';}
template <typename A,typename B>
inline void prt(unordered_map<A,B> v){cout<<'{';ll c=0;for(auto &p: v){cout<<p.first<<":"<<p.second;c++;if(c!=v.size())cout<<", ";}cout<<'}'<<'\n';}
template <typename T> 
inline void prt(set<T> v){cout<<'{';for(auto i=v.begin();i!=v.end();i++){cout<<*i;if(i!=--v.end())cout<<", ";}cout<<'}'<<'\n';}
template <typename T> 
inline void prt(multiset<T> v){cout<<'{';for(auto i=v.begin();i!=v.end();i++){cout<<*i;if(i!=--v.end())cout<<", ";}cout<<'}'<<'\n';}
 
int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    //input
    ll n,k;
    cin >> n >> k;
    vector<ll>a(k);
    rep(i,k)cin>>a[i];
    if(n>=1e7){
        bool ans = true;
        rep(i,k-1){
            if(a[i]<100)continue;
            ll dif = a[i+1]-a[i];
            if(dif==1||dif==3||dif==5)ans=false;
        }
        //if(ans)cout<<"Yes"<<endl;
        if(!ans){
            cout << "No" << endl;
            return 0;
        }
    }
    vector<bool>dp(1e7+100,true);
    rep(i,k){
        if(a[i]>1e7)continue;
        dp[a[i]]=false;
    }
    for(int i=1e7;i>=1;i--){
        for(int j=1;j<=3;j++){
            if(!dp[i+j]&&!dp[i+7-j])dp[i]=false;
        }
    }
    if(dp[1])cout<<"Yes"<<endl;
    else cout <<"No" << endl;
    return 0;
}
0