結果

問題 No.1811 EQUIV Ten
ユーザー asaringoasaringo
提出日時 2022-01-15 18:31:45
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 1,152 bytes
コンパイル時間 1,468 ms
コンパイル使用メモリ 166,064 KB
実行使用メモリ 9,780 KB
最終ジャッジ日時 2023-08-14 03:29:59
合計ジャッジ時間 4,918 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 AC 1 ms
4,380 KB
testcase_17 AC 1 ms
4,376 KB
testcase_18 AC 1 ms
4,376 KB
testcase_19 AC 1 ms
4,380 KB
testcase_20 AC 2 ms
4,380 KB
testcase_21 AC 3 ms
4,376 KB
testcase_22 AC 2 ms
4,376 KB
testcase_23 AC 8 ms
7,584 KB
testcase_24 AC 3 ms
4,476 KB
testcase_25 AC 2 ms
4,376 KB
testcase_26 AC 7 ms
6,980 KB
testcase_27 AC 2 ms
4,376 KB
testcase_28 AC 1 ms
4,380 KB
testcase_29 AC 1 ms
4,376 KB
testcase_30 RE -
testcase_31 AC 2 ms
4,380 KB
testcase_32 AC 4 ms
4,380 KB
testcase_33 AC 4 ms
4,540 KB
testcase_34 RE -
testcase_35 AC 7 ms
6,716 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std ;
typedef long long ll ;
typedef long double ld ;
typedef pair<ll,ll> P ;
typedef tuple<bool,ll,ll,ll> TP ;
#define chmin(a,b) a = min(a,b)
#define chmax(a,b) a = max(a,b)
#define bit_count(x) __builtin_popcountll(x)
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) a / gcd(a,b) * b
#define rep(i,n) for(int i = 0 ; i < n ; i++)
#define rrep(i,a,b) for(int i = a ; i < b ; i++)
#define endl "\n"

const int mod = 1000000007 ;

ll powmod(ll x , ll n){
    ll res = 1 ;
    while(n > 0){
        if(n & 1) (res *= x) %= mod ;
        (x *= x) %= mod ;
        n >>= 1 ;
    }
    return res ;
}

ll n ;
ll dp[101010][2][2][2] ;

int main(){
    cin >> n ;
    if(n <= 3){
        cout << 0 << endl ;
        return 0 ;
    }
    rep(i,2) rep(j,2) rep(k,2) dp[3][i][j][k] = 1 ;
    rrep(a,3,n){
        rep(i,2) rep(j,2) rep(k,2) rep(l,2){
            if(i == 1 && j == 0 && k == 1 && l == 0) continue ;
            (dp[a+1][i][j][k] += dp[a][j][k][l]) %= mod ;
        }
    }
    ll sum = 0 ;
    rep(i,2) rep(j,2) rep(k,2) (sum += dp[n][i][j][k]) %= mod ;
    cout << (powmod(2,n) - sum + mod) % mod << endl ;
}
0