結果
問題 |
No.2278 Time Bomb Game 2
|
ユーザー |
![]() |
提出日時 | 2024-07-03 18:48:08 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 816 bytes |
コンパイル時間 | 336 ms |
コンパイル使用メモリ | 40,448 KB |
最終ジャッジ日時 | 2025-02-22 01:54:07 |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 53 WA * 17 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:47:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 47 | scanf("%d%d%d%s", &n, &k, &t, s); | ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
/* -*- coding: utf-8 -*- * * 2278.cc: No.2278 Time Bomb Game 2 - yukicoder */ #include<cstdio> #include<algorithm> using namespace std; /* constant */ const int MAX_N = 200000; /* typedef */ /* global variables */ char s[MAX_N + 4]; /* subroutines */ bool check(int n, int t, int x, int p) { bool f = false; if (t & 1) { f = (x > 0 && ! check(n, t - 1, x - 1, p ^ 1)) || (x + 1 < n && ! check(n, t - 1, x + 1, p ^ 1)); } else { if (t == 0) f = (s[x] - 'A' != p); else { f = (s[x] - 'A' != p) && ((x >= 2 && s[x - 2] - 'A' != p) || (x + 2 < n && s[x + 2] - 'A' != p)); } } return f; } /* main */ int main() { int n, k, t; scanf("%d%d%d%s", &n, &k, &t, s); k--; if (check(n, t, k, 0)) puts("Alice"); else puts("Bob"); return 0; }