結果

問題 No.1242 高橋君とすごろく
ユーザー kibunakibuna
提出日時 2020-10-02 22:23:35
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,129 bytes
コンパイル時間 1,811 ms
コンパイル使用メモリ 180,880 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-27 08:41:21
合計ジャッジ時間 2,795 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using lint         = long long;
constexpr lint inf = 1LL << 60;
constexpr lint mod = 1000000007;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    lint n, k;
    cin >> n >> k;
    vector<lint> a(k);
    priority_queue<lint> pq;
    for (int i = 0; i < k; ++i) {
        cin >> a[i];
        pq.push(a[i]);
    }
    map<lint, bool> mp;
    while (!pq.empty()) {
        lint idx = pq.top();
        pq.pop();
        if (idx <= 0)
            break;
        mp[idx] = true;
        bool ok = false;
        for (lint j = idx + 1; j <= idx + 6; ++j) {
            if (!mp[j])
                ok = true;
        }
        if (!ok) {
            cout << "No"
                 << "\n";
            return 0;
        }
        if (mp[idx + 5]) {
            pq.push(idx - 1);
        }
        if (mp[idx + 3]) {
            pq.push(idx - 2);
        }
        if (mp[idx + 1]) {
            pq.push(idx - 3);
        }
    }
    if (mp[1]) {
        cout << "No"
             << "\n";
    } else {
        cout << "Yes"
             << "\n";
    }
    return 0;
}
0