結果

問題 No.1811 EQUIV Ten
ユーザー HaaHaa
提出日時 2022-01-14 22:05:08
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 69 ms / 2,000 ms
コード長 972 bytes
コンパイル時間 1,594 ms
コンパイル使用メモリ 168,852 KB
実行使用メモリ 36,068 KB
最終ジャッジ日時 2023-08-12 19:47:22
合計ジャッジ時間 3,833 ms
ジャッジサーバーID
(参考情報)
judge7 / judge9
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,384 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 55 ms
30,164 KB
testcase_12 AC 61 ms
32,584 KB
testcase_13 AC 66 ms
34,924 KB
testcase_14 AC 69 ms
36,068 KB
testcase_15 AC 68 ms
35,912 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 2 ms
4,380 KB
testcase_18 AC 2 ms
4,376 KB
testcase_19 AC 2 ms
4,380 KB
testcase_20 AC 5 ms
4,608 KB
testcase_21 AC 4 ms
4,512 KB
testcase_22 AC 1 ms
4,376 KB
testcase_23 AC 24 ms
14,112 KB
testcase_24 AC 6 ms
5,252 KB
testcase_25 AC 2 ms
4,380 KB
testcase_26 AC 20 ms
11,956 KB
testcase_27 AC 2 ms
4,376 KB
testcase_28 AC 2 ms
4,376 KB
testcase_29 AC 2 ms
4,380 KB
testcase_30 AC 55 ms
29,444 KB
testcase_31 AC 3 ms
4,376 KB
testcase_32 AC 6 ms
5,456 KB
testcase_33 AC 6 ms
5,620 KB
testcase_34 AC 53 ms
28,080 KB
testcase_35 AC 19 ms
11,692 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> P;
typedef vector<ll> VI;
typedef vector<VI> VVI;
#define REP(i,n) for(ll i=0;i<(n);i++)
#define ALL(v) v.begin(),v.end()
template<typename T> bool chmax(T &x, const T &y) {return (x<y)?(x=y,true):false;};
template<typename T> bool chmin(T &x, const T &y) {return (x>y)?(x=y,true):false;};
constexpr ll MOD=1000000007;
constexpr ll INF=2e18;

ll power(ll x, ll y){
    x%=MOD;
    ll ret=1;
    while(y){
        if(y&1) ret=ret*x%MOD;
        x=x*x%MOD;
        y>>=1;
    }
    return ret;
}

int main(){
    int n; cin >> n;
    VVI dp(n+1,VI(16,0));
    dp[0][0]=1;
    ll ans=0;
    REP(i,n){
        REP(j,16){
            int x=j*2%16;
            dp[i+1][x]=(dp[i+1][x]+dp[i][j])%MOD;
            dp[i+1][x+1]=(dp[i+1][x+1]+dp[i][j])%MOD;
        }
        ans=(ans+dp[i+1][10]*power(2,n-i-1)%MOD)%MOD;
        dp[i+1][10]=0;
    }
    cout << ans << endl;
    return 0;
}
0