結果

問題 No.1770 N言っちゃダメゲーム (6)
ユーザー ngtkanangtkana
提出日時 2020-06-11 02:09:30
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,120 bytes
コンパイル時間 2,693 ms
コンパイル使用メモリ 208,660 KB
実行使用メモリ 14,192 KB
最終ジャッジ日時 2023-09-16 21:57:35
合計ジャッジ時間 3,939 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,380 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 1 ms
4,376 KB
testcase_10 AC 19 ms
12,664 KB
testcase_11 AC 18 ms
12,508 KB
testcase_12 AC 18 ms
12,380 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 1 ms
4,380 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 1 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,380 KB
testcase_22 AC 1 ms
4,376 KB
testcase_23 AC 1 ms
4,380 KB
testcase_24 AC 2 ms
4,376 KB
testcase_25 AC 2 ms
4,376 KB
testcase_26 AC 3 ms
4,380 KB
testcase_27 AC 2 ms
4,376 KB
testcase_28 AC 20 ms
12,264 KB
testcase_29 AC 10 ms
6,864 KB
testcase_30 AC 18 ms
11,488 KB
testcase_31 AC 8 ms
6,280 KB
testcase_32 AC 22 ms
13,896 KB
testcase_33 AC 23 ms
14,020 KB
testcase_34 AC 23 ms
14,020 KB
testcase_35 AC 23 ms
14,060 KB
testcase_36 AC 24 ms
14,020 KB
testcase_37 AC 22 ms
14,008 KB
testcase_38 AC 22 ms
13,984 KB
testcase_39 AC 22 ms
14,020 KB
testcase_40 AC 22 ms
14,192 KB
testcase_41 AC 24 ms
14,032 KB
testcase_42 AC 21 ms
14,076 KB
testcase_43 WA -
testcase_44 AC 15 ms
10,384 KB
testcase_45 AC 22 ms
13,920 KB
testcase_46 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

/*
 * 嘘解法
 * y + k への遷移を忘れる
 */
#include <bits/stdc++.h>

int main() {
    int n, k;
    std::cin >> n >> k;

    if (k==1) {
        std::cout << 1 << '\n';
        return 0;
    }

    std::vector<std::vector<int>> a(n+1);
    std::vector<int> b = {1};
    for (int i = 2; i <= n; i++) {
        auto&& v = a.at(i);
        int x = b.back();
        auto transite = [&](int j) {
            int d = i - j;
            if (d <= k && (a.at(j).empty()
                       || (a.at(j).size() == int{1} && a.at(j).front() == d)))
            {
                v.push_back(d);
            }
        };
        transite(x);
        transite((i + x) / 2);
        if (int{1} != b.size()) {
            int y = b.at(b.size() - 2);
            transite((i + y) / 2);
        }
        std::sort(v.begin(), v.end());
        v.resize(std::unique(v.begin(), v.end()) - v.begin()); if (v.empty()) b.push_back(i);
    }

    std::vector<int> ans = a.at(n);
    if (ans.empty()) {
        std::cout << 0 << '\n';
    } else {
        for (int x: ans) {
            std::cout << x << '\n';
        }
    }
}

0