結果

問題 No.1682 Unfair Game
ユーザー otoshigootoshigo
提出日時 2021-09-17 22:44:18
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,298 bytes
コンパイル時間 4,335 ms
コンパイル使用メモリ 263,952 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-12 08:45:16
合計ジャッジ時間 5,662 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using mint = modint1000000007;
using ll = long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;  using vvi = vector<vi>;
using vl = vector<ll>;   using vvl = vector<vl>;
using vb = vector<bool>; using vvb = vector<vb>;
using vm = vector<mint>; using vvm = vector<vm>;
using vpi = vector<pii>; using vvpi = vector<vpi>;
using vpl = vector<pll>; using vvpl = vector<vpl>;
const int inf = 1 << 30;
const ll INF = 1LL << 60;
#define rep(i,m,n) for (int i = m; i < (int)(n); i++)
#define rrep(i,m,n) for (int i = m; i > (int)(n); i--)

int main(){
    int n; cin >> n;
    vi P(n);
    rep(i,0,n){
        cin >> P[i];
    }
    vvm dp(n+1,vm(3));
    dp[0][0] = 1;
    rep(i,0,n){
        dp[i+1][0] += dp[i][0];
        dp[i+1][1] += dp[i][1];
        dp[i+1][2] += dp[i][2];
        if (P[i] < 50){
            dp[i+1][1] += dp[i][1];
            dp[i+1][0] += dp[i][0];
        }
        else if (P[i] > 50){
            dp[i+1][0] += dp[i][1];
            dp[i+1][1] += dp[i][0];
        }
        else{
            dp[i+1][2] += dp[i][1] + dp[i][0];
        }
    }
    cout << dp[n][1].val() << endl;
}
0