結果

問題 No.1506 Unbalanced Pocky Game
ユーザー Manuel1024
提出日時 2021-05-15 01:21:47
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 59 ms / 2,000 ms
コード長 442 bytes
コンパイル時間 601 ms
コンパイル使用メモリ 73,016 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-02 08:07:51
合計ジャッジ時間 3,629 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 63
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
using namespace std;

int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    for(auto &p: a) cin >> p;

    vector<bool> memo(n, false);
    memo[0] = true;
    for(int i = 1; i < n; i++){
        if(a[i] == 1){
            memo[i] = !memo[i-1];
        }else{
            memo[i] = true;
        }
    }

    if(memo[n-1]) cout << "Alice" << endl;
    else cout << "Bob" << endl;
    return 0;
}
0