結果
| 問題 | 
                            No.361 門松ゲーム2
                             | 
                    
| コンテスト | |
| ユーザー | 
                             ふーらくたる
                         | 
                    
| 提出日時 | 2018-01-06 03:32:00 | 
| 言語 | C++11(廃止可能性あり)  (gcc 13.3.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 108 ms / 2,000 ms | 
| コード長 | 661 bytes | 
| コンパイル時間 | 589 ms | 
| コンパイル使用メモリ | 62,684 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-12-23 07:42:47 | 
| 合計ジャッジ時間 | 2,211 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 28 | 
ソースコード
#include <iostream>
#include <set>
using namespace std;
int g[510];
int main() {
    int L, D;
    cin >> L >> D;
    for (int x = 6; x <= L; x++) {
        set<int> S;
        for (int L1 = 1; 3 * L1 <= x; L1++) {
            for (int L2 = L1 + 1; L2 < x - (L1 + L2); L2++) {
                int L3 = x - (L1 + L2);
                if (L3 - L1 > D) continue;
                S.insert(g[L1] ^ g[L2] ^ g[L3]);
            }
        }
        int num = 0;
        for (int n : S) {
            if (num != n) break;
            num++;
        }
        g[x] = num;
    }
    if (g[L]) cout << "kado" << endl;
    else cout << "matsu" << endl;
    return 0;
}
            
            
            
        
            
ふーらくたる