結果

問題 No.1702 count good string
ユーザー ygd.ygd.
提出日時 2021-10-10 11:00:00
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 329 ms / 2,000 ms
コード長 759 bytes
コンパイル時間 1,698 ms
コンパイル使用メモリ 86,716 KB
実行使用メモリ 77,700 KB
最終ジャッジ日時 2023-10-12 05:51:13
合計ジャッジ時間 12,181 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 85 ms
71,576 KB
testcase_01 AC 86 ms
71,480 KB
testcase_02 AC 90 ms
75,516 KB
testcase_03 AC 91 ms
76,596 KB
testcase_04 AC 91 ms
76,636 KB
testcase_05 AC 91 ms
76,564 KB
testcase_06 AC 91 ms
76,696 KB
testcase_07 AC 89 ms
76,612 KB
testcase_08 AC 90 ms
76,580 KB
testcase_09 AC 91 ms
76,620 KB
testcase_10 AC 92 ms
76,448 KB
testcase_11 AC 91 ms
76,592 KB
testcase_12 AC 90 ms
76,372 KB
testcase_13 AC 235 ms
77,148 KB
testcase_14 AC 235 ms
77,700 KB
testcase_15 AC 235 ms
77,352 KB
testcase_16 AC 329 ms
77,204 KB
testcase_17 AC 237 ms
77,368 KB
testcase_18 AC 236 ms
77,504 KB
testcase_19 AC 233 ms
77,420 KB
testcase_20 AC 240 ms
77,664 KB
testcase_21 AC 238 ms
77,284 KB
testcase_22 AC 234 ms
77,424 KB
testcase_23 AC 96 ms
77,344 KB
testcase_24 AC 95 ms
77,264 KB
testcase_25 AC 95 ms
77,264 KB
testcase_26 AC 95 ms
77,344 KB
testcase_27 AC 96 ms
77,268 KB
testcase_28 AC 96 ms
77,020 KB
testcase_29 AC 96 ms
77,416 KB
testcase_30 AC 100 ms
77,248 KB
testcase_31 AC 96 ms
77,036 KB
testcase_32 AC 97 ms
77,388 KB
testcase_33 AC 213 ms
77,460 KB
testcase_34 AC 213 ms
77,356 KB
testcase_35 AC 213 ms
77,236 KB
testcase_36 AC 210 ms
77,444 KB
testcase_37 AC 212 ms
77,144 KB
testcase_38 AC 214 ms
77,416 KB
testcase_39 AC 210 ms
77,336 KB
testcase_40 AC 209 ms
77,448 KB
testcase_41 AC 210 ms
77,244 KB
testcase_42 AC 213 ms
77,440 KB
testcase_43 AC 222 ms
77,412 KB
testcase_44 AC 224 ms
77,176 KB
testcase_45 AC 85 ms
71,552 KB
testcase_46 AC 84 ms
71,356 KB
testcase_47 AC 84 ms
71,724 KB
testcase_48 AC 85 ms
71,728 KB
testcase_49 AC 83 ms
71,444 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
#input = sys.stdin.readline
#input = sys.stdin.buffer.readline
import copy

def main():
    N = int(input()); MOD = pow(10,9) + 7
    S = input()
    Y = "yukicoder"
    T = [Y]
    for i in range(9):
        temp = Y[:i] + "?" + Y[i+1:]
        T.append(temp)
    #print(T)
    ans = 0
    for t in T:
        #print(t)
        #i番目まで一致している場合の数
        dp = [0]*10
        dp[0] = 1
        for i in range(N):
            p = copy.copy(dp)
            dp,p = p,dp
            for j in range(9):
                if S[i] == t[j]:
                    dp[j+1] += p[j]
                    dp[j+1] %= MOD
            #print(dp)
        ans += dp[9]
        ans %= MOD
    print(ans)





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