結果

問題 No.1242 高橋君とすごろく
ユーザー takaygtakayg
提出日時 2020-10-02 23:02:01
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 2,011 bytes
コンパイル時間 2,254 ms
コンパイル使用メモリ 211,192 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-27 08:45:21
合計ジャッジ時間 3,428 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define rep(i, n) for(int i = 0; i < (int)(n); i ++)
#define rrep(i, n) for(int i = (int)(n) - 1; i >= 0; i --)
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vll vector<ll>
#define vpi vector<pii>
#define vpll vector<pll>
#define sll set<ll>
#define spll set<pll>
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define mod 1000000007
#define mod2 998244353
#define inf 1000000000000000000
#define pi acos(-1)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rsort(a) sort(a.rbegin(), a.rend())
#define print(x) for(auto i : (x)) cout << i << " "; cout << endl
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
// const ll dx[] = {-1,0,1,0,-1,-1,1,1};
// const ll dy[] = {0,-1,0,1,-1,1,-1,1};


int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << setprecision(15) << fixed;

    ll n, k; cin >> n >> k;
    vll a(k);
    sll s;
    rep(i, k) { 
        cin >> a[i];
        s.insert(a[i]);
    }
    bool flag = true;
    priority_queue<ll> queue;
    for (auto i : a) queue.push(i);

    while(queue.size() != 0) {
        auto i = queue.top(); queue.pop();
        for (int j = 1; j <= 6; j++) {
            if (i - j < 1 || (i - j) + (7 - j) >= n) continue;
            if (s.find((i - j) + (7 - j)) != s.end()) {
                queue.push(i - j);
                s.insert(i - j);
            }
        }
        if (s.find(1) != s.end()) {
            flag = false;
            break;
        }
        if (s.find(i - 1) != s.end() && s.find(i - 2) != s.end()) {
            flag = false;
            break;
        }
    }
    if (flag) cout << "Yes" << endl;
    else cout << "No" << endl;
}

0