結果
| 問題 | 
                            No.1702 count good string
                             | 
                    
| コンテスト | |
| ユーザー | 
                             vwxyz
                         | 
                    
| 提出日時 | 2021-10-08 22:51:13 | 
| 言語 | Python3  (3.13.1 + numpy 2.2.1 + scipy 1.14.1)  | 
                    
| 結果 | 
                             
                                TLE
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 448 bytes | 
| コンパイル時間 | 312 ms | 
| コンパイル使用メモリ | 12,544 KB | 
| 実行使用メモリ | 11,008 KB | 
| 最終ジャッジ日時 | 2024-07-23 06:03:04 | 
| 合計ジャッジ時間 | 51,332 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge1 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 26 TLE * 21 | 
ソースコード
import sys
readline=sys.stdin.readline
N=int(readline())
S=readline().rstrip()
lst=["yukicoder"]
for i in range(9):
    s="yukicoder"
    s=s[:i]+"?"+s[i+1:]
    lst.append(s)
mod=10**9+7
ans=0
for ss in lst:
    dp=[0]*10
    dp[0]=1
    for s in S:
        prev=dp
        dp=[x for x in dp]
        for i in range(9):
            if ss[i]==s:
                dp[i+1]+=prev[i]
                dp[i+1]%=mod
    ans+=dp[9]
    ans%=mod
print(ans)
            
            
            
        
            
vwxyz