結果

問題 No.1702 count good string
ユーザー roarisroaris
提出日時 2021-10-17 19:59:30
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 536 bytes
コンパイル時間 734 ms
コンパイル使用メモリ 81,792 KB
実行使用メモリ 211,008 KB
最終ジャッジ日時 2023-10-17 22:32:15
合計ジャッジ時間 12,458 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 37 ms
53,444 KB
testcase_02 WA -
testcase_03 AC 47 ms
61,800 KB
testcase_04 AC 47 ms
61,800 KB
testcase_05 AC 47 ms
61,800 KB
testcase_06 AC 47 ms
61,800 KB
testcase_07 AC 47 ms
61,800 KB
testcase_08 AC 47 ms
61,800 KB
testcase_09 AC 47 ms
61,800 KB
testcase_10 AC 46 ms
61,800 KB
testcase_11 WA -
testcase_12 AC 46 ms
61,800 KB
testcase_13 AC 410 ms
208,104 KB
testcase_14 AC 410 ms
208,104 KB
testcase_15 AC 409 ms
208,104 KB
testcase_16 AC 461 ms
209,060 KB
testcase_17 AC 405 ms
208,104 KB
testcase_18 AC 410 ms
208,104 KB
testcase_19 WA -
testcase_20 AC 413 ms
208,104 KB
testcase_21 WA -
testcase_22 AC 423 ms
209,056 KB
testcase_23 AC 59 ms
72,164 KB
testcase_24 AC 55 ms
72,164 KB
testcase_25 AC 57 ms
72,164 KB
testcase_26 AC 56 ms
72,164 KB
testcase_27 AC 57 ms
72,164 KB
testcase_28 AC 56 ms
72,164 KB
testcase_29 AC 56 ms
72,164 KB
testcase_30 AC 56 ms
72,164 KB
testcase_31 AC 55 ms
72,164 KB
testcase_32 WA -
testcase_33 AC 408 ms
208,104 KB
testcase_34 AC 406 ms
208,104 KB
testcase_35 AC 408 ms
208,104 KB
testcase_36 AC 405 ms
208,104 KB
testcase_37 AC 406 ms
208,104 KB
testcase_38 AC 406 ms
208,104 KB
testcase_39 AC 404 ms
208,104 KB
testcase_40 AC 405 ms
208,104 KB
testcase_41 AC 402 ms
208,104 KB
testcase_42 AC 409 ms
208,104 KB
testcase_43 WA -
testcase_44 WA -
testcase_45 AC 37 ms
53,444 KB
testcase_46 AC 37 ms
53,444 KB
testcase_47 AC 37 ms
53,444 KB
testcase_48 AC 37 ms
53,444 KB
testcase_49 AC 37 ms
53,444 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

def f(T):
    dp = [[0]*N for _ in range(len(T)+1)]
    dp[0][0] = 1
    
    for i in range(len(T)):
        acc = [0]
        
        for j in range(N):
            acc.append((acc[-1]+dp[i][j])%MOD)
        
        for j in range(N):
            if S[j]==T[i]:
                dp[i+1][j] = acc[j]
    
    return sum(dp[-1])%MOD
    
N = int(input())
S = input()[:-1]
MOD = 10**9+7
T = 'yukicoder'
ans = f(T)

for i in range(len(T)):
    ans += f(T[:i]+'?'+T[i+1:])
    ans %= MOD

print(ans)
0