結果

問題 No.1770 N言っちゃダメゲーム (6)
ユーザー trineutrontrineutron
提出日時 2020-05-30 17:56:09
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
MLE  
実行時間 -
コード長 962 bytes
コンパイル時間 726 ms
コンパイル使用メモリ 80,352 KB
実行使用メモリ 814,372 KB
最終ジャッジ日時 2023-09-16 21:56:14
合計ジャッジ時間 4,275 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 25 ms
17,052 KB
testcase_07 AC 25 ms
17,164 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 26 ms
17,168 KB
testcase_11 AC 27 ms
17,232 KB
testcase_12 AC 26 ms
17,168 KB
testcase_13 AC 1 ms
4,376 KB
testcase_14 AC 1 ms
4,376 KB
testcase_15 AC 1 ms
4,376 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 3 ms
4,376 KB
testcase_18 AC 2 ms
4,380 KB
testcase_19 AC 2 ms
4,376 KB
testcase_20 AC 2 ms
4,384 KB
testcase_21 AC 1 ms
4,376 KB
testcase_22 AC 2 ms
4,376 KB
testcase_23 AC 9 ms
4,380 KB
testcase_24 AC 3 ms
4,376 KB
testcase_25 AC 86 ms
10,732 KB
testcase_26 AC 284 ms
17,260 KB
testcase_27 AC 78 ms
10,084 KB
testcase_28 MLE -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <cassert>

int main() {
    int n, k;
    std::cin >> n >> k;
    assert(1 <= k and k < n and n <= 200000);
    std::vector<std::vector<bool>> dp(n + k, std::vector<bool>(k + 1)); // declarer
    for (int i = 0; i <= k; i++) {
        dp.at(n - 1).at(i) = true;
    }
    for (int i = n - 2; i >= 0; i--) {
        std::vector<int> w;
        for (int j = 1; j <= k; j++) {
            if (dp.at(i + j).at(j)) {
                w.push_back(j);
            }
        }
        if (w.size() == 0) {
            for (int j = 1; j <= k; j++) {
                dp.at(i).at(j) = true;
            }
        } else if (w.size() == 1) {
            dp.at(i).at(w.at(0)) = true;
        }
    }
    bool win = false;
    for (int i = 1; i <= k; i++) {
        if (dp.at(i).at(i)) {
            win = true;
            std::cout << i << std::endl;
        }
    }
    if (!win) {
        std::cout << 0 << std::endl;
    }
}
0