結果

問題 No.1811 EQUIV Ten
ユーザー lloyzlloyz
提出日時 2022-01-15 00:02:49
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,007 ms / 2,000 ms
コード長 645 bytes
コンパイル時間 428 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 87,680 KB
最終ジャッジ日時 2024-04-30 18:47:18
合計ジャッジ時間 9,978 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 32 ms
10,880 KB
testcase_01 AC 31 ms
10,752 KB
testcase_02 AC 29 ms
10,752 KB
testcase_03 AC 29 ms
10,752 KB
testcase_04 AC 30 ms
10,752 KB
testcase_05 AC 30 ms
10,752 KB
testcase_06 AC 30 ms
10,880 KB
testcase_07 AC 29 ms
10,880 KB
testcase_08 AC 30 ms
10,752 KB
testcase_09 AC 30 ms
10,880 KB
testcase_10 AC 30 ms
10,880 KB
testcase_11 AC 854 ms
74,752 KB
testcase_12 AC 884 ms
79,744 KB
testcase_13 AC 991 ms
85,760 KB
testcase_14 AC 1,001 ms
87,680 KB
testcase_15 AC 1,007 ms
87,680 KB
testcase_16 AC 29 ms
10,752 KB
testcase_17 AC 30 ms
11,008 KB
testcase_18 AC 32 ms
11,008 KB
testcase_19 AC 31 ms
10,752 KB
testcase_20 AC 70 ms
14,080 KB
testcase_21 AC 65 ms
13,696 KB
testcase_22 AC 31 ms
11,008 KB
testcase_23 AC 358 ms
36,992 KB
testcase_24 AC 93 ms
15,872 KB
testcase_25 AC 32 ms
10,880 KB
testcase_26 AC 285 ms
31,872 KB
testcase_27 AC 41 ms
11,904 KB
testcase_28 AC 30 ms
10,880 KB
testcase_29 AC 29 ms
10,880 KB
testcase_30 AC 794 ms
72,832 KB
testcase_31 AC 53 ms
12,416 KB
testcase_32 AC 100 ms
16,512 KB
testcase_33 AC 108 ms
17,024 KB
testcase_34 AC 759 ms
69,632 KB
testcase_35 AC 279 ms
31,360 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
mod = 10**9 + 7

if n <= 3:
    print(0)
    exit()

DP = [[0 for _ in range(8)] for _ in range(n + 1)]
for i in range(8):
    DP[3][i] = 1
for i in range(3, n):
    DP[i + 1][0] = DP[i][0] + DP[i][4]
    DP[i + 1][1] = DP[i][0] + DP[i][4]
    DP[i + 1][2] = DP[i][1]
    DP[i + 1][3] = DP[i][1] + DP[i][5]
    DP[i + 1][4] = DP[i][2] + DP[i][6]
    DP[i + 1][5] = DP[i][2] + DP[i][6]
    DP[i + 1][6] = DP[i][3] + DP[i][7]
    DP[i + 1][7] = DP[i][3] + DP[i][7]
    for j in range(8):
        DP[i + 1][j] %= mod

ans = pow(2, n, mod)
for i in range(8):
    ans -= DP[n][i]
    ans %= mod
print(ans)
0