Submission #70142831
Source Code Expand
#include <bits/stdc++.h>
using namespace std;
/////////////////// メイン ///////////////////
int main () {
/////////////////// 前入力 ///////////////////
int q;
cin >> q;
/////////////////// 前処理 ///////////////////
/////////////////// ループ ///////////////////
for (int loop=0; loop<q; loop++) {
//////////////////// 入力 ////////////////////
int n;
cin >> n;
vector<int> a(n);
for (int i=0; i<n; i++) {
cin >> a.at(i);
}
//////////////// 出力変数定義 ////////////////
string result = "Alice";
//////////////////// 処理 ////////////////////
// aの全ての値の、ORの値とXORの値を計算する
int num_or = 0;
int num_xor = 0;
for (int i : a) {
num_or |= i;
num_xor ^= i;
}
// 両者が同じなら後手の勝ち
if (num_or==num_xor) result = "Bob";
//////////////////// 出力 ////////////////////
cout << result << endl;
}
/////////////////// 後処理 ///////////////////
//////////////////// 終了 ////////////////////
return 0;
}
Submission Info
| Submission Time | |
|---|---|
| Task | A - Bitwise OR Game |
| User | wightou |
| Language | C++ 23 (gcc 12.2) |
| Score | 500 |
| Code Size | 1179 Byte |
| Status | AC |
| Exec Time | 159 ms |
| Memory | 4112 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 500 / 500 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | 00_sample_00.txt |
| All | 00_sample_00.txt, 01_handmade_00.txt, 01_handmade_01.txt, 01_handmade_02.txt, 01_handmade_03.txt, 01_handmade_04.txt, 01_handmade_05.txt, 01_handmade_06.txt, 01_handmade_07.txt, 01_handmade_08.txt, 01_handmade_09.txt, 02_Bob_00.txt, 02_Bob_01.txt, 02_Bob_02.txt, 02_Bob_03.txt, 02_Bob_04.txt, 02_Bob_05.txt, 02_Bob_06.txt, 02_Bob_07.txt, 02_Bob_08.txt, 03_Alice_00.txt, 03_Alice_01.txt, 03_Alice_02.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 00_sample_00.txt | AC | 1 ms | 3628 KiB |
| 01_handmade_00.txt | AC | 133 ms | 3548 KiB |
| 01_handmade_01.txt | AC | 159 ms | 3608 KiB |
| 01_handmade_02.txt | AC | 91 ms | 3536 KiB |
| 01_handmade_03.txt | AC | 118 ms | 3468 KiB |
| 01_handmade_04.txt | AC | 158 ms | 3544 KiB |
| 01_handmade_05.txt | AC | 122 ms | 3480 KiB |
| 01_handmade_06.txt | AC | 93 ms | 3644 KiB |
| 01_handmade_07.txt | AC | 51 ms | 3480 KiB |
| 01_handmade_08.txt | AC | 54 ms | 4112 KiB |
| 01_handmade_09.txt | AC | 54 ms | 3896 KiB |
| 02_Bob_00.txt | AC | 53 ms | 3616 KiB |
| 02_Bob_01.txt | AC | 53 ms | 3544 KiB |
| 02_Bob_02.txt | AC | 50 ms | 3548 KiB |
| 02_Bob_03.txt | AC | 50 ms | 3496 KiB |
| 02_Bob_04.txt | AC | 49 ms | 3976 KiB |
| 02_Bob_05.txt | AC | 49 ms | 3952 KiB |
| 02_Bob_06.txt | AC | 50 ms | 4016 KiB |
| 02_Bob_07.txt | AC | 44 ms | 3896 KiB |
| 02_Bob_08.txt | AC | 121 ms | 3488 KiB |
| 03_Alice_00.txt | AC | 53 ms | 3448 KiB |
| 03_Alice_01.txt | AC | 54 ms | 3556 KiB |
| 03_Alice_02.txt | AC | 53 ms | 3556 KiB |