結果

問題 No.1811 EQUIV Ten
ユーザー ぷらぷら
提出日時 2022-01-14 22:08:20
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,057 bytes
コンパイル時間 2,396 ms
コンパイル使用メモリ 202,244 KB
実行使用メモリ 16,000 KB
最終ジャッジ日時 2024-04-30 15:00:46
合計ジャッジ時間 4,399 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 WA -
testcase_02 AC 2 ms
6,940 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 2 ms
6,944 KB
testcase_07 AC 1 ms
6,944 KB
testcase_08 AC 2 ms
6,940 KB
testcase_09 AC 2 ms
6,940 KB
testcase_10 AC 1 ms
6,944 KB
testcase_11 AC 143 ms
13,824 KB
testcase_12 AC 155 ms
14,592 KB
testcase_13 AC 170 ms
15,488 KB
testcase_14 AC 177 ms
16,000 KB
testcase_15 AC 175 ms
16,000 KB
testcase_16 AC 2 ms
6,944 KB
testcase_17 AC 2 ms
6,940 KB
testcase_18 AC 2 ms
6,940 KB
testcase_19 AC 2 ms
6,944 KB
testcase_20 AC 8 ms
6,944 KB
testcase_21 AC 7 ms
6,948 KB
testcase_22 AC 2 ms
6,940 KB
testcase_23 AC 57 ms
7,808 KB
testcase_24 AC 11 ms
6,940 KB
testcase_25 AC 2 ms
6,940 KB
testcase_26 AC 46 ms
6,940 KB
testcase_27 AC 3 ms
6,940 KB
testcase_28 AC 2 ms
6,944 KB
testcase_29 AC 2 ms
6,944 KB
testcase_30 AC 139 ms
13,568 KB
testcase_31 AC 5 ms
6,944 KB
testcase_32 AC 12 ms
6,940 KB
testcase_33 AC 13 ms
6,940 KB
testcase_34 AC 130 ms
12,928 KB
testcase_35 AC 45 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;

constexpr int mod = 1000000007;

long long modpow(long long a,long long b) {
    long long ans = 1;
    while(b) {
        if(b & 1) {
            (ans *= a) %= mod;
        }
        (a *= a) %= mod;
        b /= 2;
    }
    return ans;
}

int dp[200001][1 << 4];

int main() {
    int N;
    cin >> N;
    for(int i = 0; i < 16; i++) {
        dp[4][i] = 1;
    }
    dp[4][10] = 0;
    long long ans = modpow(2,N-4);
    for(int i = 4; i < N; i++) {
        for(int j = 0; j < 16; j++) {
            if(j/2 == 10) {
                ans += modpow(2,N-i-1)*dp[i][j]%mod;
                ans %= mod;
            }
            else {
                dp[i+1][j/2] += dp[i][j];
                dp[i+1][j/2] %= mod;
            }
            if(j/2+8 == 10) {
                ans += modpow(2,N-i-1)*dp[i][j]%mod;
                ans %= mod;
            }
            else {
                dp[i+1][j/2+8] += dp[i][j];
                dp[i+1][j/2+8] %= mod;
            }
        }
    }
    cout << ans << endl;
}
0