結果
| 問題 |
No.2103 ±1s Game
|
| コンテスト | |
| ユーザー |
tnakao0123
|
| 提出日時 | 2024-07-18 18:08:44 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 643 bytes |
| コンパイル時間 | 2,142 ms |
| コンパイル使用メモリ | 40,192 KB |
| 最終ジャッジ日時 | 2025-02-23 16:12:29 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 27 WA * 7 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:32:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
32 | scanf("%d%d%d%d", &x, &y, &k, &p);
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
/* -*- coding: utf-8 -*-
*
* 2103.cc: No.2103 ツア1s Game - yukicoder
*/
#include<cstdio>
#include<algorithm>
using namespace std;
/* subroutines */
bool check(int x, int y, int k, int p) {
int n = x + y - k;
if (n & 1) {
bool f1 =
(x > 0 && check(x - 1, y, k, -p)) ||
(y > 0 && check(x, y - 1, k, -p));
return ! f1;
}
int h = n / 2;
if (y <= h) return p > 0;
if (x <= h) return ((y & 1) == (p > 0 ? 0 : 1));
return false;
}
/* main */
int main() {
int x, y, k, p;
scanf("%d%d%d%d", &x, &y, &k, &p);
bool f0 = check(x, y, k, p);
if (f0) puts("Alice");
else puts("Bob");
return 0;
}
tnakao0123