結果

問題 No.1682 Unfair Game
ユーザー noya2noya2
提出日時 2021-09-17 22:41:06
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,344 bytes
コンパイル時間 4,452 ms
コンパイル使用メモリ 253,096 KB
最終ジャッジ日時 2025-01-24 15:12:55
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

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