結果
| 問題 | No.361 門松ゲーム2 |
| コンテスト | |
| ユーザー |
beet
|
| 提出日時 | 2018-12-06 16:03:39 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 423 ms / 2,000 ms |
| コード長 | 728 bytes |
| 記録 | |
| コンパイル時間 | 1,291 ms |
| コンパイル使用メモリ | 216,284 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-06-07 05:06:43 |
| 合計ジャッジ時間 | 3,253 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 28 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
//INSERT ABOVE HERE
Int dp[555];
Int dfs(Int x,Int d){
Int &res=dp[x];
if(~res) return res;
res=0;
set<Int> ss;
for(Int a=1;a<x;a++){
for(Int b=1;b<a&&a+b<x;b++){
Int c=x-(a+b);
if(a==c||b==c) continue;
if(max({a,b,c})-min({a,b,c})>d) continue;
ss.emplace(dfs(a,d)^dfs(b,d)^dfs(c,d));
}
}
while(ss.count(res)) res++;
return res;
}
signed main(){
Int l,d;
cin>>l>>d;
memset(dp,-1,sizeof(dp));
cout<<(dfs(l,d)?"kado":"matsu")<<endl;
return 0;
}
beet