結果
| 問題 | No.2814 Block Game |
| コンテスト | |
| ユーザー |
risujiroh
|
| 提出日時 | 2024-07-19 22:51:24 |
| 言語 | C++23 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
CE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 578 bytes |
| 記録 | |
| コンパイル時間 | 1,957 ms |
| コンパイル使用メモリ | 322,360 KB |
| 最終ジャッジ日時 | 2026-04-02 18:46:52 |
| 合計ジャッジ時間 | 3,003 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge5_1 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
In file included from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/bits/stl_algobase.h:76,
from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/algorithm:62,
from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/x86_64-pc-linux-gnu/bits/stdc++.h:53,
from main.cpp:1:
/home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/bit: In instantiation of 'constexpr int std::__popcount(_Tp) [with _Tp = long int]':
/home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/bit:339:29: required from 'constexpr bool std::__has_single_bit(_Tp) [with _Tp = long int]'
339 | { return std::__popcount(__x) == 1; }
| ~~~~~~~~~~~~~~~^~~~~
main.cpp:19:30: required from here
19 | if (std::__has_single_bit(n) && n != 2) {
| ~~~~~~~~~~~~~~~~~~~~~^~~
/home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/bit:308:34: error: argument 1 in call to function '__builtin_popcountg' has signed type
308 | return __builtin_popcountg(__x);
| ^~~
ソースコード
#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