結果
問題 | No.361 門松ゲーム2 |
ユーザー |
![]() |
提出日時 | 2019-06-03 22:36:47 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 102 ms / 2,000 ms |
コード長 | 1,150 bytes |
コンパイル時間 | 1,502 ms |
コンパイル使用メモリ | 166,860 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-17 20:37:00 |
合計ジャッジ時間 | 2,697 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 28 |
ソースコード
#include<bits/stdc++.h>using namespace std;typedef long long ll;typedef pair<int,int> pii;typedef pair<pii,int> ppii;typedef pair<int,pii> pipi;typedef pair<ll,ll> pll;typedef pair<ll,pll> plpl;typedef tuple<ll,ll,ll> tl;ll mod=1000000007;ll mod2=998244353;ll inf=1000000000000000000;#define rep(i,m,n) for(int i=m;i<n;i++)#define rrep(i,n,m) for(int i=n;i>=m;i--)ll lmax(ll a,ll b){if(a<b)return b;else return a;}ll lmin(ll a,ll b){if(a<b)return a;else return b;}int main(){int g[1000];fill(g,g+1000,-1);rep(i,1,6)g[i]=0;int l,d;cin>>l>>d;if(d==1||l<=5){cout<<"matsu"<<endl;return 0;}rep(i,6,l+1){set<int> st;rep(j,1,ceil((double)i/3)){rep(k,j+2,j+d+1){if(j+j+1+k>i)break;if(i-j-k>=k||i-j-k<=j)continue;st.insert(g[j]^g[k]^g[i-j-k]);}}int gg=0;while(st.count(gg)!=0)gg++;g[i]=gg;}if(g[l]==0)cout<<"matsu"<<endl;else cout<<"kado"<<endl;//rep(i,1,l+1)cout<<g[i]<<" ";}