Submission #44111625
Source Code Expand
// WEBLINK
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <queue>
using namespace std;
using ll = long long;
using ii = pair<int, int>;
using iii = pair<ii, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vii = vector<ii>;
#define pb push_back
#define fst first
#define snd second
#define all(x) (x).begin,(x).end()
#define rall(x) (x).rbegin,(x).rend()
// ------------- SORT -------------------
template<class T> void Sort(vector<T> & a) { sort(a.begin(), a.end()); }
template<class T> void Rsort(vector<T> & a) { sort(a.rbegin(), a.rend()); }
// ------------- INPUT -------------------
template<class T> void inp(T & x) { cin >> x; }
template<class T> void inp(vector<T> & t) { for (auto && x : t) cin >> x; }
// ---------- MOD --------------------
const int mod = 1000000007;
void add(int & x, int y) {
x += y;
if (x < 0) x += mod;
if (x >= mod) x -= mod;
}
int add2(int x, int y) {
x += y;
if (x < 0) x += mod;
if (x >= mod) x -= mod;
return x;
}
int mul(int x, int y) {ll r = x; r *= y; return r % mod;}
int power(int x, int p) {
if (x < 0 or p < 0) return 0;
int r = 1;
while (p > 0)
{
if (p & 1) r = mul(r, x);
x = mul(x, x); p /= 2;
} return r;
}
int inv(int a) { return power(a, mod - 2); }
// ------------- MINMAX -------------------
template<typename T, typename T1>T amax(T &a, T1 b) {if (b > a)a = b; return a;}
template<typename T, typename T1>T amin(T &a, T1 b) {if (b < a)a = b; return a;}
// ---------- DEBUG --------------------
//#define ON_PC
#ifdef ON_PC
#include </Users/karanaggarwal/code/debug.h>
#else
#define deb(x...)
#endif
///////////////////////////////////
int get(queue<int> & q)
{
if (q.empty()) return 1000000000;
return q.front();
}
void solve()
{
int n;
string s;
cin >> n >> s;
queue<int> A, B;
for (int i = 0; i <= n; i++)
if (s[i] == 'A')
A.push(i);
else
B.push(i);
for (int k = 0; k < n; k++)
{
if (k % 2 == 0 and !B.empty())
B.pop();
if (k % 2 == 1 and !A.empty())
A.pop();
if (get(A) < get(B)) cout << "Alice" << endl;
else cout << "Bob" << endl;
}
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int t = 1;
// cin >> t;
while (t--)
{
solve();
}
return 0;
}
Submission Info
| Submission Time | |
|---|---|
| Task | A - Mex Game |
| User | karanaggarwal |
| Language | C++ (GCC 9.2.1) |
| Score | 300 |
| Code Size | 2404 Byte |
| Status | AC |
| Exec Time | 291 ms |
| Memory | 4412 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 300 / 300 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | 01_sample_01.txt, 01_sample_02.txt, 01_sample_03.txt |
| All | 01_sample_01.txt, 01_sample_02.txt, 01_sample_03.txt, 02_small_01.txt, 02_small_02.txt, 02_small_03.txt, 02_small_04.txt, 03_rand_01.txt, 03_rand_02.txt, 03_rand_03.txt, 03_rand_04.txt, 03_rand_05.txt, 04_max_rand_01.txt, 04_max_rand_02.txt, 04_max_rand_03.txt, 04_max_rand_04.txt, 04_max_rand_05.txt, 05_half_half_01.txt, 05_half_half_02.txt, 05_half_half_03.txt, 05_half_half_04.txt, 05_half_half_05.txt, 06_hand_01.txt, 06_hand_02.txt, 06_hand_03.txt, 06_hand_04.txt, 06_hand_05.txt, 06_hand_06.txt, 06_hand_07.txt, 06_hand_08.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 01_sample_01.txt | AC | 1 ms | 3500 KiB |
| 01_sample_02.txt | AC | 2 ms | 3452 KiB |
| 01_sample_03.txt | AC | 6 ms | 3512 KiB |
| 02_small_01.txt | AC | 1 ms | 3588 KiB |
| 02_small_02.txt | AC | 2 ms | 3504 KiB |
| 02_small_03.txt | AC | 2 ms | 3452 KiB |
| 02_small_04.txt | AC | 2 ms | 3632 KiB |
| 03_rand_01.txt | AC | 31 ms | 3636 KiB |
| 03_rand_02.txt | AC | 169 ms | 3600 KiB |
| 03_rand_03.txt | AC | 154 ms | 3744 KiB |
| 03_rand_04.txt | AC | 202 ms | 3872 KiB |
| 03_rand_05.txt | AC | 122 ms | 3780 KiB |
| 04_max_rand_01.txt | AC | 285 ms | 4120 KiB |
| 04_max_rand_02.txt | AC | 285 ms | 4004 KiB |
| 04_max_rand_03.txt | AC | 283 ms | 4116 KiB |
| 04_max_rand_04.txt | AC | 289 ms | 4232 KiB |
| 04_max_rand_05.txt | AC | 283 ms | 4188 KiB |
| 05_half_half_01.txt | AC | 291 ms | 4112 KiB |
| 05_half_half_02.txt | AC | 284 ms | 4176 KiB |
| 05_half_half_03.txt | AC | 283 ms | 4220 KiB |
| 05_half_half_04.txt | AC | 284 ms | 3984 KiB |
| 05_half_half_05.txt | AC | 284 ms | 4112 KiB |
| 06_hand_01.txt | AC | 286 ms | 4160 KiB |
| 06_hand_02.txt | AC | 285 ms | 4068 KiB |
| 06_hand_03.txt | AC | 285 ms | 4412 KiB |
| 06_hand_04.txt | AC | 285 ms | 4248 KiB |
| 06_hand_05.txt | AC | 283 ms | 3980 KiB |
| 06_hand_06.txt | AC | 285 ms | 4188 KiB |
| 06_hand_07.txt | AC | 283 ms | 4064 KiB |
| 06_hand_08.txt | AC | 284 ms | 4088 KiB |