結果

問題 No.1682 Unfair Game
ユーザー noya2noya2
提出日時 2021-09-17 22:41:06
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,344 bytes
コンパイル時間 4,084 ms
コンパイル使用メモリ 263,288 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-12 08:41:29
合計ジャッジ時間 5,204 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
#define rep(i,n) for (int i = 0; i < int(n); ++i)
#define repp(i,n,m) for (int i = m; i < int(n); ++i)
using namespace std;
using namespace atcoder;
template<class T>istream &operator>>(istream &is,vector<T> &v){for(auto &e:v)is>>e;return is;}
template<class T>ostream &operator<<(ostream &os,const vector<T> &v){if(v.size()==0){os<<endl;}else{rep(i,v.size())os<<v[i]<<(i+1==v.size()?"\n":" ");}return os;}
template<class T>istream &operator>>(istream &is,vector<vector<T>> &v){for(auto &e:v)is>>e;return is;}
template<class T>ostream &operator<<(ostream &os,const vector<vector<T>> &v){if(v.size()==0){os<<endl;}else{for(auto &e:v)os<<e;}return os;}
template<typename T>void mout(T a){cout<<a.val()<<endl;}


int main(){
    using mint = modint1000000007;
    int n; cin >> n;
    vector<int> ar(n);
    cin >> ar;
    auto get = [&](int x, int y){
        if (x * y == 0) return 0;
        if (x == y) return 2;
        return 1;
    };
    vector<vector<mint>> dp(n+1,vector<mint>(3,0));
    rep(i,n) {
        int y = 0;
        if (ar[i] > 50) y = 1;
        else if (ar[i] < 50) y = 2;
        dp[i+1][y] += 1;
        rep(j,3){
            dp[i+1][get(j,y)] += dp[i][j];
            dp[i+1][j] += dp[i][j];
        }
    }
    //mout(dp[n][0]);
    mout(dp[n][1]);
    //mout(dp[n][2]);
}
0