結果

問題 No.2814 Block Game
ユーザー 沙耶花
提出日時 2024-07-19 21:54:07
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 909 bytes
コンパイル時間 4,131 ms
コンパイル使用メモリ 251,108 KB
最終ジャッジ日時 2025-02-23 16:30:55
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other WA * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace atcoder;
using mint = modint998244353;
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf32 1000000001
#define Inf64 1000000000000000001

int main(){

	int _t;
	cin>>_t;
	rep(_,_t){
		long long n;
		cin>>n;
		string s;
		cin>>s;
		
		long long x = 1LL;
		rep(j,60){
			if(((n-1)>>j)&1)x*=2;
		}
		long long y = n-x;
		long long z = (n+1)/2;
		long long w = n-z;
		if(y==0){
			if((n%2==0)==(s[0]=='E')){
				cout<<"Alice"<<endl;
			}
			else{
				cout<<"Bob"<<endl;
			}
			continue;
		}
		if(w==0){
			if(s[0]=='O')cout<<"Alice"<<endl;
			else cout<<"Bob"<<endl;
			continue;
		}
		if(x==1||y==1||z==1||w==1){
			cout<<"Alice"<<endl;
			continue;
		}
		long long sum = (x-2) + (y-2) + (z-2) + (w-2);
		if(sum%2==0){
			cout<<"Bob"<<endl;
		}
		else{
			cout<<"Alice"<<endl;
		}
	}
	
	return 0;
}
0