結果
| 問題 | No.361 門松ゲーム2 |
| コンテスト | |
| ユーザー |
izuru_matsuura
|
| 提出日時 | 2016-09-14 00:42:48 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 29 ms / 2,000 ms |
| コード長 | 1,403 bytes |
| 記録 | |
| コンパイル時間 | 1,528 ms |
| コンパイル使用メモリ | 169,792 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-17 05:14:39 |
| 合計ジャッジ時間 | 2,643 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 28 |
ソースコード
#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;
}
const int INF = 1<<28;
void solve() {
vector<int> gr(L + 1, INF);
gr[0] = 0;
for (int x = 1; x <= L; x++) {
vector<bool> pos(x, false);
for (int a = 1; a <= x; a++) {
for (int b = a + 1; a + b <= x; b++) {
int c = x - a - b;
if (not (a < b and b < c)) continue;
if (c - a > D) continue;
pos[ gr[a] ^ gr[b] ^ gr[c] ] = true;
}
}
for (int i = 0; i <= x; i++) {
if (not pos[i]) {
gr[x] = i;
break;
}
}
}
cout << (gr[L] ? "kado" : "matsu") << endl;
}
}
int main() {
input(); solve();
return 0;
}
izuru_matsuura