結果

問題 No.361 門松ゲーム2
ユーザー h_nosonh_noson
提出日時 2016-06-19 16:38:23
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 108 ms / 2,000 ms
コード長 818 bytes
コンパイル時間 701 ms
コンパイル使用メモリ 71,432 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-19 13:00:19
合計ジャッジ時間 1,610 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 1 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 1 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 2 ms
5,376 KB
testcase_13 AC 1 ms
5,376 KB
testcase_14 AC 57 ms
5,376 KB
testcase_15 AC 3 ms
5,376 KB
testcase_16 AC 37 ms
5,376 KB
testcase_17 AC 14 ms
5,376 KB
testcase_18 AC 7 ms
5,376 KB
testcase_19 AC 11 ms
5,376 KB
testcase_20 AC 4 ms
5,376 KB
testcase_21 AC 37 ms
5,376 KB
testcase_22 AC 108 ms
5,376 KB
testcase_23 AC 9 ms
5,376 KB
testcase_24 AC 9 ms
5,376 KB
testcase_25 AC 11 ms
5,376 KB
testcase_26 AC 16 ms
5,376 KB
testcase_27 AC 20 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <set>
using namespace std;

#define REP(i,s,e) for (i = s; i <= e; i++)
#define rep(i,n) REP (i,0,(int)(n)-1)
#define RREP(i,s,e) for (i = s; i >= e; i--)
#define rrep(i,n) RREP (i,(int)(n)-1,0)
#define INF (int)1e8
#define MOD (int)(1e9+7)

typedef long long ll;

int grundy[501];

int main(void) {
    int l, d;
    cin >> l >> d;

    int i, j, k;
    REP (i,1,l) {
        set<int> st;
        REP (j,1,i/3) REP (k,j+1,i/2) if (i - (j+k) > k && i - (j+k) - j <= d) {
            st.insert(grundy[j] ^ grundy[k] ^ grundy[i-(j+k)]);
        }
        j = 0;
        while (st.count(j)) j++;
        grundy[i] = j;
    }
    if (grundy[l] > 0)
        cout << "kado" << endl;
    else
        cout << "matsu" << endl;
    return 0;
}
0