結果

問題 No.1506 Unbalanced Pocky Game
ユーザー nawawannawawan
提出日時 2021-05-14 22:42:56
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 948 bytes
コンパイル時間 624 ms
コンパイル使用メモリ 73,608 KB
実行使用メモリ 22,152 KB
最終ジャッジ日時 2024-04-10 01:34:11
合計ジャッジ時間 4,246 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,812 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 2 ms
6,944 KB
testcase_03 WA -
testcase_04 AC 29 ms
14,356 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 22 ms
11,432 KB
testcase_09 WA -
testcase_10 AC 36 ms
17,256 KB
testcase_11 AC 16 ms
9,112 KB
testcase_12 WA -
testcase_13 AC 9 ms
6,944 KB
testcase_14 AC 15 ms
8,824 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 12 ms
7,272 KB
testcase_19 AC 10 ms
6,940 KB
testcase_20 AC 36 ms
16,964 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 2 ms
6,944 KB
testcase_25 WA -
testcase_26 AC 75 ms
21,544 KB
testcase_27 AC 76 ms
21,884 KB
testcase_28 AC 75 ms
21,112 KB
testcase_29 WA -
testcase_30 AC 77 ms
22,136 KB
testcase_31 WA -
testcase_32 AC 75 ms
21,576 KB
testcase_33 AC 75 ms
21,520 KB
testcase_34 AC 74 ms
21,240 KB
testcase_35 WA -
testcase_36 AC 2 ms
6,940 KB
testcase_37 AC 2 ms
6,940 KB
testcase_38 WA -
testcase_39 WA -
testcase_40 AC 2 ms
6,944 KB
testcase_41 WA -
testcase_42 AC 2 ms
6,944 KB
testcase_43 WA -
testcase_44 WA -
testcase_45 AC 2 ms
6,940 KB
testcase_46 AC 27 ms
9,592 KB
testcase_47 AC 10 ms
6,940 KB
testcase_48 WA -
testcase_49 WA -
testcase_50 WA -
testcase_51 AC 31 ms
10,504 KB
testcase_52 WA -
testcase_53 AC 37 ms
12,024 KB
testcase_54 AC 15 ms
6,944 KB
testcase_55 WA -
testcase_56 AC 11 ms
6,940 KB
testcase_57 AC 27 ms
9,608 KB
testcase_58 WA -
testcase_59 AC 7 ms
6,944 KB
testcase_60 AC 18 ms
7,260 KB
testcase_61 AC 26 ms
9,560 KB
testcase_62 AC 23 ms
8,192 KB
testcase_63 WA -
testcase_64 WA -
testcase_65 AC 18 ms
7,272 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
using namespace std;
int dfs(int now, int t, vector<vector<int>>&dp, vector<int>&A, bool turn){
    if(dp[t][now] != -1) return dp[t][now];
    if(t == 0) return dfs(now - 1, A[now - 1], dp, A, !turn);
    if(turn){
        bool f = false;
        for(int j = 0; j < t; j++){
            f |= dfs(now, j, dp, A, !turn);
        }
        return dp[t][now] = f;
    }
    else{
        bool f = true;
        for(int j = 0; j < t; j++){
            f &= dfs(now, j, dp, A, !turn);
        }
        return dp[t][now] = f;
    }
}
int main(){
    int N;
    cin >> N;
    vector<int> A(N);
    int sum = 0;
    for(int i = 0; i < N; i++) {
        cin >> A[i];
        if(A[i] > 1) A[i] = 2;
    }
    vector<vector<int>> dp(3, vector<int>(N, -1));
    dp[0][0] = true;
    dp[1][0] = false;
    bool res = dfs(N - 1, A[N - 1], dp, A, true);
    if(res) cout << "Alice" << endl;
    else cout << "Bob" << endl;
}
0