結果

問題 No.1702 count good string
ユーザー chineristACchineristAC
提出日時 2021-10-08 22:11:02
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 167 ms / 2,000 ms
コード長 701 bytes
コンパイル時間 947 ms
コンパイル使用メモリ 86,732 KB
実行使用メモリ 80,976 KB
最終ジャッジ日時 2023-09-30 10:28:30
合計ジャッジ時間 8,813 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 98 ms
74,236 KB
testcase_01 AC 99 ms
74,064 KB
testcase_02 AC 98 ms
73,732 KB
testcase_03 AC 134 ms
78,144 KB
testcase_04 AC 105 ms
78,172 KB
testcase_05 AC 100 ms
78,004 KB
testcase_06 AC 99 ms
77,704 KB
testcase_07 AC 102 ms
78,140 KB
testcase_08 AC 102 ms
78,188 KB
testcase_09 AC 99 ms
77,984 KB
testcase_10 AC 101 ms
78,048 KB
testcase_11 AC 100 ms
78,292 KB
testcase_12 AC 105 ms
78,044 KB
testcase_13 AC 167 ms
80,644 KB
testcase_14 AC 133 ms
80,676 KB
testcase_15 AC 135 ms
80,536 KB
testcase_16 AC 138 ms
80,972 KB
testcase_17 AC 140 ms
80,736 KB
testcase_18 AC 149 ms
80,508 KB
testcase_19 AC 138 ms
80,976 KB
testcase_20 AC 143 ms
80,612 KB
testcase_21 AC 155 ms
80,668 KB
testcase_22 AC 149 ms
80,804 KB
testcase_23 AC 110 ms
79,532 KB
testcase_24 AC 111 ms
79,412 KB
testcase_25 AC 113 ms
79,372 KB
testcase_26 AC 114 ms
79,564 KB
testcase_27 AC 110 ms
79,304 KB
testcase_28 AC 110 ms
79,372 KB
testcase_29 AC 109 ms
78,980 KB
testcase_30 AC 109 ms
79,528 KB
testcase_31 AC 111 ms
78,984 KB
testcase_32 AC 111 ms
79,256 KB
testcase_33 AC 140 ms
80,540 KB
testcase_34 AC 141 ms
80,752 KB
testcase_35 AC 155 ms
80,560 KB
testcase_36 AC 148 ms
80,536 KB
testcase_37 AC 143 ms
80,792 KB
testcase_38 AC 143 ms
80,816 KB
testcase_39 AC 140 ms
80,712 KB
testcase_40 AC 135 ms
80,496 KB
testcase_41 AC 144 ms
80,252 KB
testcase_42 AC 143 ms
80,808 KB
testcase_43 AC 142 ms
80,460 KB
testcase_44 AC 144 ms
80,720 KB
testcase_45 AC 102 ms
74,340 KB
testcase_46 AC 99 ms
74,092 KB
testcase_47 AC 99 ms
74,344 KB
testcase_48 AC 104 ms
74,172 KB
testcase_49 AC 106 ms
74,340 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys,random
from collections import deque
from heapq import heappush,heappop

input = lambda :sys.stdin.readline().rstrip()
mi = lambda :map(int,input().split())
li = lambda :list(mi())

mod = 10**9 + 7

N = int(input())
S = input()

T = "yukicoder"

dp = [0 for i in range(2*len(T)+2)]
dp[0] = 1
for i in range(N):
    ndp = [x for x in dp]
    for j in range(len(T)):
        if S[i]==T[j]:
            ndp[2*j+2] += dp[2*j]
            ndp[2*j+2] %= mod

            ndp[2*j+3] += dp[2*j+1]
            ndp[2*j+3] %= mod
        
        elif S[i]=="?":
            ndp[2*j+3] += dp[2*j]
            ndp[2*j+3] %= mod
    
    dp = ndp

res = dp[2*len(T)] + dp[2*len(T)+1]
print(res % mod)


0