結果
| 問題 |
No.2814 Block Game
|
| コンテスト | |
| ユーザー |
risujiroh
|
| 提出日時 | 2024-07-19 22:51:24 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 60 ms / 2,000 ms |
| コード長 | 578 bytes |
| コンパイル時間 | 3,037 ms |
| コンパイル使用メモリ | 243,960 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-19 22:51:32 |
| 合計ジャッジ時間 | 6,784 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 20 |
ソースコード
#include <bits/stdc++.h>
using Int = int64_t;
void Solve() {
Int n;
std::cin >> n;
std::string s;
std::cin >> s;
if (s == "Odd") {
bool wins = n & 1;
if (n == 2) {
wins = !wins;
}
std::cout << (wins ? "Alice\n" : "Bob\n");
} else {
assert(s == "Even");
bool wins = n & 1;
if (std::__has_single_bit(n) && n != 2) {
wins = !wins;
}
std::cout << (wins ? "Alice\n" : "Bob\n");
}
}
int main() {
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
Int t;
std::cin >> t;
while (t--) {
Solve();
}
}
risujiroh