結果

問題 No.1242 高橋君とすごろく
ユーザー takaygtakayg
提出日時 2020-10-02 22:57:33
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 2,216 bytes
コンパイル時間 2,174 ms
コンパイル使用メモリ 209,964 KB
実行使用メモリ 104,484 KB
最終ジャッジ日時 2023-09-24 22:34:10
合計ジャッジ時間 6,397 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

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,                // 要素の型はint
      vector<ll>,   // 内部コンテナはstd::vector (デフォルトのまま)
      greater<ll>   // 昇順 (デフォルトはstd::less<T>)
    > 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