結果
| 問題 |
No.2278 Time Bomb Game 2
|
| コンテスト | |
| ユーザー |
tnakao0123
|
| 提出日時 | 2024-07-03 18:54:56 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 842 bytes |
| コンパイル時間 | 311 ms |
| コンパイル使用メモリ | 40,064 KB |
| 最終ジャッジ日時 | 2025-02-22 01:54:16 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 WA * 1 |
| other | AC * 55 WA * 15 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:48:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
48 | 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 == 1 || x == n - 1 ||
(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;
}
tnakao0123