結果

問題 No.361 門松ゲーム2
ユーザー nebukuro09nebukuro09
提出日時 2017-03-10 01:30:34
言語 D
(dmd 2.105.2)
結果
AC  
実行時間 95 ms / 2,000 ms
コード長 810 bytes
コンパイル時間 710 ms
コンパイル使用メモリ 102,732 KB
実行使用メモリ 4,404 KB
最終ジャッジ日時 2023-09-03 02:03:03
合計ジャッジ時間 2,841 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, core.stdc.stdio;

void main() {
    auto s = readln.split.map!(to!int);
    auto L = s[0];
    auto D = s[1];

    auto grundy = new int[](L+1);
    foreach (i; 6..L+1) {
        bool[int] mex;
        foreach (a; 1..i) {
            foreach (b; a+1..i) {
                auto c = i - a - b;
                if (c <= b || c - a > D) continue;
                mex[grundy[a] ^ grundy[b] ^ grundy[c]] = true;
            }
        }

        for (int j = 0; ; j++) {
            if (!(j in mex)) {
                grundy[i] = j;
                break;
            }
        }

    }

    writeln(grundy[L] == 0 ? "matsu" : "kado");
}
0