提出 #70103207
ソースコード 拡げる
#include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define FORR2(x,y,arr) for(auto& [x,y]:arr)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
template<class T> bool chmax(T &a, const T &b) { if(a<b){a=b;return 1;}return 0;}
template<class T> bool chmin(T &a, const T &b) { if(a>b){a=b;return 1;}return 0;}
//-------------------------------------------------------
int T,N,A[202020];
int C[30];
void solve() {
int i,j,k,l,r,x,y; string s;
cin>>T;
while(T--) {
cin>>N;
ZERO(C);
FOR(i,N) {
cin>>A[i];
FOR(j,30) if(A[i]&(1<<j)) C[j]++;
}
for(i=29;i>=0;i--) if(C[i]) {
if(C[i]%2==0) {
cout<<"Alice"<<endl;
break;
}
}
if(i==-1) cout<<"Bob"<<endl;
}
}
int main(int argc,char** argv){
string s;int i;
if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
cout.tie(0); solve(); return 0;
}
提出情報
| 提出日時 |
|
| 問題 |
A - Bitwise OR Game |
| ユーザ |
kmjp |
| 言語 |
C++ 20 (gcc 12.2) |
| 得点 |
500 |
| コード長 |
1175 Byte |
| 結果 |
AC |
| 実行時間 |
137 ms |
| メモリ |
4388 KiB |
コンパイルエラー
Main.cpp: In function ‘void solve()’:
Main.cpp:19:17: warning: unused variable ‘k’ [-Wunused-variable]
19 | int i,j,k,l,r,x,y; string s;
| ^
Main.cpp:19:19: warning: unused variable ‘l’ [-Wunused-variable]
19 | int i,j,k,l,r,x,y; string s;
| ^
Main.cpp:19:21: warning: unused variable ‘r’ [-Wunused-variable]
19 | int i,j,k,l,r,x,y; string s;
| ^
Main.cpp:19:23: warning: unused variable ‘x’ [-Wunused-variable]
19 | int i,j,k,l,r,x,y; string s;
| ^
Main.cpp:19:25: warning: unused variable ‘y’ [-Wunused-variable]
19 | int i,j,k,l,r,x,y; string s;
| ^
Main.cpp: In function ‘int main(int, char**)’:
Main.cpp:6:19: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation]
6 | #define FOR(x,to) for(x=0;x<(to);x++)
| ^~~
Main.cpp:45:9: note: in expansion of macro ‘FOR’
45 | FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
| ^~~
Main.cpp:6:19: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’
6 | #define FOR(x,to) for(x=0;x<(to);x++)
| ^~~
Main.cpp:45:45: note: in expansion of macro ‘FOR’
45 | FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
| ^~~
Main.cpp:6:28: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::__cxx11::basic_string<char>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
6 | #define FOR(x,to) for(x=0;x<(to);x++)
| ^
Main.cpp:45:45: note: in expansion of macro ‘FOR’
45 | FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
| ^~~
ジャッジ結果
| セット名 |
Sample |
All |
| 得点 / 配点 |
0 / 0 |
500 / 500 |
| 結果 |
|
|
| セット名 |
テストケース |
| 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 |
| ケース名 |
結果 |
実行時間 |
メモリ |
| 00_sample_00.txt |
AC |
1 ms |
3516 KiB |
| 01_handmade_00.txt |
AC |
116 ms |
3328 KiB |
| 01_handmade_01.txt |
AC |
118 ms |
3612 KiB |
| 01_handmade_02.txt |
AC |
78 ms |
3420 KiB |
| 01_handmade_03.txt |
AC |
82 ms |
3480 KiB |
| 01_handmade_04.txt |
AC |
137 ms |
3612 KiB |
| 01_handmade_05.txt |
AC |
104 ms |
3424 KiB |
| 01_handmade_06.txt |
AC |
77 ms |
3428 KiB |
| 01_handmade_07.txt |
AC |
38 ms |
3488 KiB |
| 01_handmade_08.txt |
AC |
18 ms |
4264 KiB |
| 01_handmade_09.txt |
AC |
18 ms |
4200 KiB |
| 02_Bob_00.txt |
AC |
40 ms |
3424 KiB |
| 02_Bob_01.txt |
AC |
40 ms |
3424 KiB |
| 02_Bob_02.txt |
AC |
33 ms |
3400 KiB |
| 02_Bob_03.txt |
AC |
33 ms |
3424 KiB |
| 02_Bob_04.txt |
AC |
37 ms |
4252 KiB |
| 02_Bob_05.txt |
AC |
36 ms |
4132 KiB |
| 02_Bob_06.txt |
AC |
28 ms |
4248 KiB |
| 02_Bob_07.txt |
AC |
25 ms |
4388 KiB |
| 02_Bob_08.txt |
AC |
110 ms |
3388 KiB |
| 03_Alice_00.txt |
AC |
40 ms |
3388 KiB |
| 03_Alice_01.txt |
AC |
40 ms |
3448 KiB |
| 03_Alice_02.txt |
AC |
40 ms |
3480 KiB |