結果

問題 No.361 門松ゲーム2
ユーザー chikkun0310chikkun0310
提出日時 2020-04-06 23:17:09
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 28 ms / 2,000 ms
コード長 1,401 bytes
コンパイル時間 1,364 ms
コンパイル使用メモリ 165,560 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-21 10:37:02
合計ジャッジ時間 2,707 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 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 1 ms
4,380 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 1 ms
4,384 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 1 ms
4,376 KB
testcase_14 AC 11 ms
4,380 KB
testcase_15 AC 1 ms
4,376 KB
testcase_16 AC 4 ms
4,380 KB
testcase_17 AC 3 ms
4,376 KB
testcase_18 AC 3 ms
4,380 KB
testcase_19 AC 2 ms
4,380 KB
testcase_20 AC 2 ms
4,380 KB
testcase_21 AC 5 ms
4,380 KB
testcase_22 AC 28 ms
4,376 KB
testcase_23 AC 1 ms
4,380 KB
testcase_24 AC 1 ms
4,376 KB
testcase_25 AC 2 ms
4,380 KB
testcase_26 AC 2 ms
4,380 KB
testcase_27 AC 4 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include <boost/multiprecision/cpp_ll.hpp>
//typedef boost::multiprecision::cpp_ll ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define endl "\n"
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);

ll g[1000];
ll l,d;
ll hoge(ll x){
    if(g[x]!=-1)return g[x];
    bool b[10001];rep(i,0,10000)b[i]=false;
    rep(mini,1,x){
        rep(maxi,mini+2,min(x,mini+d)){
            ll mid=x-mini-maxi;
            if(mid<=mini || maxi<=mid)continue;
            b[hoge(mini)^hoge(mid)^hoge(maxi)]=true;
        }
    }
    rep(i,0,10000){
        if(!b[i])return g[x]=i;
    }
    return 0;
}

int main(){fastio
    cin>>l>>d;
    rep(i,0,999)g[i]=-1;
    ll ans=hoge(l);
    if(ans==0){
        cout<<"matsu"<<endl;
    }else{
        cout<<"kado"<<endl;
    }
    //rep(i,1,30)cout<<i<<' '<<g[i]<<endl;
    
    return 0;
}


0