結果

問題 No.1811 EQUIV Ten
ユーザー ああいいああいい
提出日時 2022-01-14 22:25:00
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 470 ms / 2,000 ms
コード長 637 bytes
コンパイル時間 384 ms
コンパイル使用メモリ 87,152 KB
実行使用メモリ 171,520 KB
最終ジャッジ日時 2023-08-12 20:39:24
合計ジャッジ時間 7,930 ms
ジャッジサーバーID
(参考情報)
judge7 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 68 ms
71,024 KB
testcase_01 AC 67 ms
70,944 KB
testcase_02 AC 82 ms
76,388 KB
testcase_03 AC 69 ms
71,064 KB
testcase_04 AC 70 ms
71,064 KB
testcase_05 AC 69 ms
71,056 KB
testcase_06 AC 69 ms
71,240 KB
testcase_07 AC 69 ms
71,224 KB
testcase_08 AC 68 ms
71,052 KB
testcase_09 AC 69 ms
71,236 KB
testcase_10 AC 69 ms
70,944 KB
testcase_11 AC 417 ms
155,176 KB
testcase_12 AC 424 ms
161,540 KB
testcase_13 AC 449 ms
169,028 KB
testcase_14 AC 460 ms
170,776 KB
testcase_15 AC 470 ms
171,520 KB
testcase_16 AC 70 ms
71,172 KB
testcase_17 AC 85 ms
76,264 KB
testcase_18 AC 88 ms
76,500 KB
testcase_19 AC 78 ms
76,360 KB
testcase_20 AC 110 ms
81,336 KB
testcase_21 AC 106 ms
80,912 KB
testcase_22 AC 90 ms
76,652 KB
testcase_23 AC 220 ms
109,204 KB
testcase_24 AC 116 ms
82,380 KB
testcase_25 AC 89 ms
76,368 KB
testcase_26 AC 198 ms
102,868 KB
testcase_27 AC 94 ms
76,724 KB
testcase_28 AC 69 ms
71,128 KB
testcase_29 AC 81 ms
76,340 KB
testcase_30 AC 403 ms
152,684 KB
testcase_31 AC 101 ms
78,948 KB
testcase_32 AC 119 ms
82,208 KB
testcase_33 AC 122 ms
82,180 KB
testcase_34 AC 386 ms
149,204 KB
testcase_35 AC 196 ms
102,056 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
dp = [[[0] * 16 for _ in range(2)] for _ in range(N+1)]
dp[0][0][0] = 1
P = 10 ** 9 + 7
for i in range(N):
    for bit in range(16):
        b = (bit << 1) % 16
        c = (bit << 1) % 16 + 1
        dp[i+1][1][b] += dp[i][1][bit]
        dp[i+1][1][c] += dp[i][1][bit]
        if b == 10:
            dp[i+1][1][b] += dp[i][0][bit]
        else:
            dp[i+1][0][b] += dp[i][0][bit]
        if c == 10:
            dp[i+1][1][c] += dp[i][0][bit]
        else:
            dp[i+1][0][c] += dp[i][0][bit]
    for bit in range(8):
        for f in range(2):
            dp[i+1][f][bit] %= P
print(sum(dp[-1][1])%P)
0