結果

問題 No.1506 Unbalanced Pocky Game
ユーザー ビーサービーサー
提出日時 2021-05-14 22:36:25
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 57 ms / 2,000 ms
コード長 3,317 bytes
コンパイル時間 1,634 ms
コンパイル使用メモリ 172,028 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-10 01:17:20
合計ジャッジ時間 4,600 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 2 ms
6,944 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 3 ms
6,940 KB
testcase_04 AC 19 ms
6,944 KB
testcase_05 AC 22 ms
6,944 KB
testcase_06 AC 14 ms
6,940 KB
testcase_07 AC 10 ms
6,944 KB
testcase_08 AC 14 ms
6,944 KB
testcase_09 AC 23 ms
6,944 KB
testcase_10 AC 24 ms
6,944 KB
testcase_11 AC 11 ms
6,940 KB
testcase_12 AC 10 ms
6,944 KB
testcase_13 AC 6 ms
6,944 KB
testcase_14 AC 11 ms
6,944 KB
testcase_15 AC 9 ms
6,944 KB
testcase_16 AC 22 ms
6,940 KB
testcase_17 AC 12 ms
6,944 KB
testcase_18 AC 8 ms
6,944 KB
testcase_19 AC 7 ms
6,944 KB
testcase_20 AC 24 ms
6,940 KB
testcase_21 AC 10 ms
6,944 KB
testcase_22 AC 15 ms
6,940 KB
testcase_23 AC 2 ms
6,944 KB
testcase_24 AC 2 ms
6,944 KB
testcase_25 AC 32 ms
6,940 KB
testcase_26 AC 56 ms
6,940 KB
testcase_27 AC 57 ms
6,944 KB
testcase_28 AC 55 ms
6,944 KB
testcase_29 AC 52 ms
6,944 KB
testcase_30 AC 55 ms
6,944 KB
testcase_31 AC 55 ms
6,940 KB
testcase_32 AC 52 ms
6,940 KB
testcase_33 AC 54 ms
6,940 KB
testcase_34 AC 49 ms
6,940 KB
testcase_35 AC 51 ms
6,940 KB
testcase_36 AC 2 ms
6,944 KB
testcase_37 AC 2 ms
6,940 KB
testcase_38 AC 2 ms
6,944 KB
testcase_39 AC 1 ms
6,944 KB
testcase_40 AC 2 ms
6,940 KB
testcase_41 AC 1 ms
6,940 KB
testcase_42 AC 2 ms
6,940 KB
testcase_43 AC 2 ms
6,940 KB
testcase_44 AC 1 ms
6,944 KB
testcase_45 AC 1 ms
6,940 KB
testcase_46 AC 22 ms
6,940 KB
testcase_47 AC 8 ms
6,940 KB
testcase_48 AC 9 ms
6,944 KB
testcase_49 AC 23 ms
6,944 KB
testcase_50 AC 20 ms
6,944 KB
testcase_51 AC 22 ms
6,940 KB
testcase_52 AC 19 ms
6,944 KB
testcase_53 AC 27 ms
6,944 KB
testcase_54 AC 11 ms
6,940 KB
testcase_55 AC 7 ms
6,944 KB
testcase_56 AC 8 ms
6,940 KB
testcase_57 AC 20 ms
6,940 KB
testcase_58 AC 8 ms
6,944 KB
testcase_59 AC 5 ms
6,940 KB
testcase_60 AC 12 ms
6,940 KB
testcase_61 AC 19 ms
6,944 KB
testcase_62 AC 16 ms
6,940 KB
testcase_63 AC 12 ms
6,940 KB
testcase_64 AC 23 ms
6,940 KB
testcase_65 AC 13 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
struct Edge
{
    ll to;
    ll cost;
};
using Graph = vector<vector<Edge>>;
using P = pair<ll, ll>;
#define mp make_pair
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define ALL(v) (v).begin(), v.end()
ll MOD = 998244353;
const ll nmax = 8;
const ll INF = 1e10;
const int MAX = 510000;
bool graph[nmax][nmax];
long long fac[MAX], finv[MAX], inv[MAX];
void Case(int i) { printf("Case #%d: ", i); }
void COMinit()
{
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++)
    {
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

ll COM(int n, int k)
{
    if (n < k)
        return 0;
    if (n < 0 || k < 0)
        return 0;

    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

vector<vector<ll>> dist = vector<vector<ll>>(nmax, vector<ll>(nmax, INF));
void warshall_floyd(ll n)
{
    for (size_t i = 0; i < n; i++)
    {
        for (size_t j = 0; j < n; j++)
        {
            for (size_t k = 0; k < n; k++)
            {
                dist[j][k] = min(dist[j][k], dist[j][i] + dist[i][k]);
            }
        }
    }
}

ll gcd(ll a, ll b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}

ll lcm(ll a, ll b)
{
    ll g = gcd(a, b);
    return a / g * b;
}

ll mulMod(ll a, ll b)
{
    return (((a % MOD) * (b % MOD)) % MOD);
}

ll powMod(ll a, ll p)
{
    if (p == 0)
    {
        return 1;
    }
    else if (p % 2 == 0)
    {
        ll half = powMod(a, p / 2);
        return mulMod(half, half);
    }
    else
    {
        return mulMod(powMod(a, p - 1), a);
    }
}

ll ceil(ll a, ll b)
{
    return (a + b - 1) / b;
}

bool isPrime(ll N)
{
    for (int i = 2; i * i <= N; i++)
    {
        if (N % i == 0)
            return false;
    }
    return true;
}

ll cntbit(ll i)
{
    if (i == 0)
        return 0;

    ll ret = 0;
    i++;
    while (i != 0)
    {
        i = i >> 1;
        ret++;
    }
    return ret - 1;
}

ll getSize(ll a)
{
    ll ret = 0;
    while (a != 0)
    {
        ret++;
        a /= 10;
    }
    return ret;
}

vector<pair<long long, long long>> prime_factorize(long long N)
{
    vector<pair<long long, long long>> res;
    for (long long a = 2; a * a <= N; ++a)
    {
        if (N % a != 0)
            continue;
        long long ex = 0;

        while (N % a == 0)
        {
            ++ex;
            N /= a;
        }

        res.push_back({a, ex});
    }

    if (N != 1)
        res.push_back({N, 1});
    return res;
}
ll dp[3][3];

ll dx[4] = {-1, 0, 0, 1};
ll dy[4] = {0, -1, 1, 0};
int main()
{
    ll N;
    cin >> N;

    ll grundy = 0;
    for (int i = 0; i < N; i++)
    {
        ll tmp;
        cin >> tmp;
        if (grundy == 0)
        {
            grundy = tmp;
        }
        else
        {
            if (tmp == 1)
            {
                grundy = 0;
            }
            else
            {
                grundy = tmp;
            }
        }
    }

    if (grundy == 0)
    {
        cout << "Bob" << endl;
    }
    else
    {
        cout << "Alice" << endl;
    }

    return 0;
}
0