結果

問題 No.1702 count good string
ユーザー 👑 tamatotamato
提出日時 2021-10-08 22:10:29
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 142 ms / 2,000 ms
コード長 1,010 bytes
コンパイル時間 265 ms
コンパイル使用メモリ 87,760 KB
実行使用メモリ 92,628 KB
最終ジャッジ日時 2023-09-30 10:27:58
合計ジャッジ時間 7,411 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 62 ms
71,716 KB
testcase_01 AC 63 ms
71,480 KB
testcase_02 AC 71 ms
71,752 KB
testcase_03 AC 70 ms
76,204 KB
testcase_04 AC 70 ms
76,080 KB
testcase_05 AC 67 ms
76,048 KB
testcase_06 AC 72 ms
76,260 KB
testcase_07 AC 69 ms
76,008 KB
testcase_08 AC 69 ms
76,068 KB
testcase_09 AC 69 ms
75,916 KB
testcase_10 AC 69 ms
76,012 KB
testcase_11 AC 68 ms
75,920 KB
testcase_12 AC 69 ms
76,184 KB
testcase_13 AC 142 ms
92,168 KB
testcase_14 AC 122 ms
92,224 KB
testcase_15 AC 120 ms
92,628 KB
testcase_16 AC 124 ms
92,092 KB
testcase_17 AC 119 ms
92,164 KB
testcase_18 AC 119 ms
92,124 KB
testcase_19 AC 122 ms
92,280 KB
testcase_20 AC 130 ms
92,228 KB
testcase_21 AC 126 ms
92,344 KB
testcase_22 AC 135 ms
92,012 KB
testcase_23 AC 73 ms
76,704 KB
testcase_24 AC 76 ms
76,540 KB
testcase_25 AC 73 ms
76,848 KB
testcase_26 AC 73 ms
76,740 KB
testcase_27 AC 74 ms
76,792 KB
testcase_28 AC 74 ms
76,588 KB
testcase_29 AC 75 ms
76,688 KB
testcase_30 AC 77 ms
76,596 KB
testcase_31 AC 78 ms
76,924 KB
testcase_32 AC 74 ms
76,540 KB
testcase_33 AC 121 ms
92,236 KB
testcase_34 AC 119 ms
92,400 KB
testcase_35 AC 120 ms
92,240 KB
testcase_36 AC 123 ms
92,392 KB
testcase_37 AC 129 ms
92,092 KB
testcase_38 AC 120 ms
92,224 KB
testcase_39 AC 121 ms
92,060 KB
testcase_40 AC 121 ms
92,176 KB
testcase_41 AC 118 ms
92,492 KB
testcase_42 AC 118 ms
92,316 KB
testcase_43 AC 130 ms
92,208 KB
testcase_44 AC 127 ms
92,128 KB
testcase_45 AC 68 ms
71,388 KB
testcase_46 AC 67 ms
71,920 KB
testcase_47 AC 62 ms
71,880 KB
testcase_48 AC 63 ms
71,572 KB
testcase_49 AC 66 ms
71,584 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 1000000007
eps = 10**-9


def main():
    import sys
    input = sys.stdin.readline

    N = int(input())
    S = input().rstrip('\n')
    T = "yukicoder"

    dp = [[0] * (N+1) for _ in range(19)]
    dp[0][0] = 1
    for i, s in enumerate(S):
        for state in range(19):
            if state < 9:
                if s == T[state]:
                    dp[state + 1][i+1] = (dp[state + 1][i+1] + dp[state][i])%mod
                elif s == "?":
                    dp[state + 10][i+1] = (dp[state + 10][i+1] + dp[state][i])%mod

                dp[state][i+1] = (dp[state][i+1] + dp[state][i])%mod
            elif 10 <= state < 18:
                if s == T[state - 9]:
                    dp[state + 1][i+1] = (dp[state + 1][i+1] + dp[state][i])%mod
                dp[state][i + 1] = (dp[state][i + 1] + dp[state][i]) % mod
            else:
                dp[state][i + 1] = (dp[state][i + 1] + dp[state][i]) % mod
    print((dp[-1][-1] + dp[9][-1])%mod)


if __name__ == '__main__':
    main()
0