結果
| 問題 |
No.3342 AAB Game
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-11-01 03:47:06 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 4 ms / 2,000 ms |
| コード長 | 1,963 bytes |
| コンパイル時間 | 1,666 ms |
| コンパイル使用メモリ | 198,336 KB |
| 実行使用メモリ | 7,716 KB |
| 最終ジャッジ日時 | 2025-11-13 21:11:06 |
| 合計ジャッジ時間 | 2,975 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 39 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using pll = pair<ll, ll>;
using vl = vector<ll>;
template <class T> using vec = vector<T>;
template <class T> using vv = vec<vec<T>>;
template <class T> using vvv = vv<vec<T>>;
template <class T> using minpq = priority_queue<T, vector<T>, greater<T>>;
#define all(a) (a).begin(),(a).end()
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define reps(i, l, r) for(ll i = (l); i < (r); ++i)
#define rrep(i, l, r) for(ll i = (r)-1; i >= (l); --i)
#define sz(x) (ll) (x).size()
template <typename T>
bool chmax(T &a, const T& b) { return a < b ? a = b, true : false; }
template <typename T>
bool chmin(T &a, const T& b) { return a > b ? a = b, true : false; }
struct Edge {
ll from, to, cost;
Edge (ll from, ll to, ll cost = 1ll) : from(from), to(to), cost(cost) {}
};
struct Graph {
vector<vector<Edge>> G;
Graph() = default;
explicit Graph(ll N) : G(N) {}
size_t size() const {
return G.size();
}
void add(ll from, ll to, ll cost = 1ll, bool direct = 0) {
G[from].emplace_back(from, to, cost);
if (!direct) G[to].emplace_back(to, from, cost);
}
vector<Edge> &operator[](const int &k) {
return G[k];
}
};
using Edges = vector<Edge>;
void solve(){
ll N; cin >> N;
string S; cin >> S;
ll cnt = count(all(S), 'B');
if(cnt == 0){
cout << "Bob" << endl;
return;
}
if(cnt == 1){
cout << "Alice" << endl;
return;
}
ll x = 0;
rep(i, N){
if(S[i] == 'B'){
if(i % 2) x--;
else x++;
}
}
x = abs(x);
if(x % 3){
cout << "Alice" << endl;
}else{
cout << "Bob" << endl;
}
return;
}
int main(){
cin.tie(nullptr);
ios_base::sync_with_stdio(false);
cout << fixed << setprecision(20);
int t = 1;
// cin >> t;
while(t--){
solve();
}
}