結果

問題 No.1506 Unbalanced Pocky Game
ユーザー MisterMister
提出日時 2021-05-14 22:11:34
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 22 ms / 2,000 ms
コード長 466 bytes
コンパイル時間 858 ms
コンパイル使用メモリ 72,240 KB
最終ジャッジ日時 2025-01-21 11:15:52
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 63
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>

using namespace std;

void solve() {
    int n;
    cin >> n;

    vector<int> xs(n);
    for (auto& x : xs) cin >> x;

    bool alice = true;
    while (!xs.empty() && xs.back() == 1) {
        alice = !alice;
        xs.pop_back();
    }

    if (xs.empty()) alice = !alice;

    cout << (alice ? "Alice" : "Bob") << "\n";
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    solve();

    return 0;
}
0