結果

問題 No.1506 Unbalanced Pocky Game
ユーザー nawawannawawan
提出日時 2021-05-14 22:53:02
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 909 bytes
コンパイル時間 604 ms
コンパイル使用メモリ 72,564 KB
実行使用メモリ 22,016 KB
最終ジャッジ日時 2024-04-10 02:02:38
合計ジャッジ時間 3,982 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 1 ms
6,944 KB
testcase_02 AC 1 ms
6,940 KB
testcase_03 WA -
testcase_04 AC 28 ms
14,356 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 15 ms
8,808 KB
testcase_08 WA -
testcase_09 AC 35 ms
16,956 KB
testcase_10 WA -
testcase_11 AC 15 ms
9,108 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 13 ms
7,912 KB
testcase_16 AC 33 ms
16,628 KB
testcase_17 AC 17 ms
9,700 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 14 ms
8,360 KB
testcase_22 WA -
testcase_23 AC 2 ms
6,940 KB
testcase_24 AC 2 ms
6,940 KB
testcase_25 AC 47 ms
22,016 KB
testcase_26 AC 74 ms
21,704 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 74 ms
21,400 KB
testcase_30 AC 76 ms
21,756 KB
testcase_31 WA -
testcase_32 AC 75 ms
21,704 KB
testcase_33 AC 75 ms
21,700 KB
testcase_34 AC 73 ms
21,240 KB
testcase_35 AC 74 ms
21,112 KB
testcase_36 WA -
testcase_37 WA -
testcase_38 AC 2 ms
6,944 KB
testcase_39 AC 2 ms
6,940 KB
testcase_40 WA -
testcase_41 AC 2 ms
6,940 KB
testcase_42 AC 2 ms
6,940 KB
testcase_43 AC 2 ms
6,940 KB
testcase_44 AC 2 ms
6,940 KB
testcase_45 AC 2 ms
6,940 KB
testcase_46 AC 27 ms
9,720 KB
testcase_47 AC 11 ms
6,944 KB
testcase_48 AC 13 ms
6,944 KB
testcase_49 AC 32 ms
10,936 KB
testcase_50 AC 28 ms
9,880 KB
testcase_51 WA -
testcase_52 AC 25 ms
8,828 KB
testcase_53 WA -
testcase_54 WA -
testcase_55 AC 10 ms
6,940 KB
testcase_56 AC 10 ms
6,940 KB
testcase_57 WA -
testcase_58 AC 10 ms
6,944 KB
testcase_59 WA -
testcase_60 AC 17 ms
7,132 KB
testcase_61 AC 26 ms
9,432 KB
testcase_62 WA -
testcase_63 AC 16 ms
6,944 KB
testcase_64 AC 32 ms
10,504 KB
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);
    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;
    bool res = dfs(N - 1, A[N - 1], dp, A, true);
    if(res) cout << "Alice" << endl;
    else cout << "Bob" << endl;
}
0