結果
| 問題 |
No.361 門松ゲーム2
|
| コンテスト | |
| ユーザー |
izuru_matsuura
|
| 提出日時 | 2016-09-13 22:19:14 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,306 bytes |
| コンパイル時間 | 1,699 ms |
| コンパイル使用メモリ | 174,404 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-11-17 05:06:19 |
| 合計ジャッジ時間 | 2,736 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 15 WA * 13 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
namespace {
typedef double real;
typedef long long ll;
template<class T> ostream& operator<<(ostream& os, const vector<T>& vs) {
if (vs.empty()) return os << "[]";
auto i = vs.begin();
os << "[" << *i;
for (++i; i != vs.end(); ++i) os << " " << *i;
return os << "]";
}
template<class T> istream& operator>>(istream& is, vector<T>& vs) {
for (auto it = vs.begin(); it != vs.end(); it++) is >> *it;
return is;
}
int L, D;
void input() {
cin >> L >> D;
}
map<pair<int, int>, int> cache;
bool dfs(int x, int w) {
auto key = make_pair(x, w);
if (cache.count(key)) return cache[key];
for (int a = 1; a <= x; a++) {
for (int b = a; a + b <= x; b++) {
int c = x - a - b;
if (c < b) continue;
if (c - a > D) continue;
if (a == b || b == c || c == a) continue;
if (not (dfs(a, !w) or dfs(b, !w) or dfs(c, !w))) return cache[key] = true;
}
}
return cache[key] = false;
}
void solve() {
cout << (dfs(L, 0) ? "kado" : "matsu") << endl;
}
}
int main() {
input(); solve();
return 0;
}
izuru_matsuura