結果

問題 No.361 門松ゲーム2
ユーザー siman
提出日時 2022-11-17 13:25:09
言語 C++17(clang)
(17.0.6 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 1,170 bytes
コンパイル時間 2,066 ms
コンパイル使用メモリ 142,456 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-09-19 02:00:00
合計ジャッジ時間 3,784 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 22 WA * 6
権限があれば一括ダウンロードができます

ソースコード

diff #
プレゼンテーションモードにする

#include <cassert>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <climits>
#include <map>
#include <queue>
#include <set>
#include <cstring>
#include <vector>
using namespace std;
typedef long long ll;
int main() {
int L, D;
cin >> L >> D;
bool is_win[L + 1];
memset(is_win, false, sizeof(is_win));
for (int l = 3; l <= L; ++l) {
bool ok = false;
for (int a = 1; a <= l; ++a) {
for (int b = 1; b <= l; ++b) {
int c = l - a - b;
if (a + b + c != l) continue;
if (a == b) continue;
if (a == c) continue;
if (b == c) continue;
if (c <= 0) continue;
int max_l = max(a, max(b, c));
int min_l = min(a, min(b, c));
if (max_l - min_l > D) continue;
int win_cnt = 0;
if (is_win[a]) ++win_cnt;
if (is_win[b]) ++win_cnt;
if (is_win[c]) ++win_cnt;
if (win_cnt % 2 == 0) {
ok = true;
}
}
}
// fprintf(stderr, "l: %d, res: %d\n", l, ok);
is_win[l] = ok;
}
if (is_win[L]) {
cout << "kado" << endl;
} else {
cout << "matsu" << endl;
}
return 0;
}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
0