結果

問題 No.1682 Unfair Game
ユーザー 👑 hitonanodehitonanode
提出日時 2021-08-08 18:03:43
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 762 bytes
コンパイル時間 733 ms
コンパイル使用メモリ 74,036 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-12 06:20:17
合計ジャッジ時間 1,800 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 1 ms
4,376 KB
testcase_08 WA -
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 WA -
testcase_14 AC 1 ms
4,376 KB
testcase_15 AC 1 ms
4,376 KB
testcase_16 AC 1 ms
4,380 KB
testcase_17 AC 1 ms
4,376 KB
testcase_18 AC 2 ms
4,380 KB
testcase_19 WA -
testcase_20 AC 2 ms
4,380 KB
testcase_21 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

// Overflow で WA になるはず
#include <iostream>
#include <vector>
using namespace std;
constexpr unsigned md = 1000000007;

int main() {
    int N;
    cin >> N;
    vector<unsigned long long> dp(3); // 0: even-dominant, 1: equal, 2: odd-dominant (1 は不要だが…)
    dp[0] = 1;
    while (N--) {
        int p;
        cin >> p;
        vector<unsigned long long> nxtdp = dp;
        if (p < 50) {
            nxtdp[0] += dp[0];
            nxtdp[1] += dp[1];
            nxtdp[2] += dp[2];
        } else if (p == 50) {
            nxtdp[1] += dp[0] + dp[1] + dp[2];
        } else {
            nxtdp[0] += dp[2];
            nxtdp[1] += dp[1];
            nxtdp[2] += dp[0];
        }
        dp = nxtdp;
    }
    cout << dp[2] % md << '\n';
}
0