結果

問題 No.1702 count good string
ユーザー O2MTO2MT
提出日時 2021-10-08 22:50:28
言語 PyPy3
(7.3.13)
結果
WA  
実行時間 -
コード長 618 bytes
コンパイル時間 453 ms
コンパイル使用メモリ 86,916 KB
実行使用メモリ 184,508 KB
最終ジャッジ日時 2023-09-30 11:58:24
合計ジャッジ時間 13,437 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
71,040 KB
testcase_01 AC 77 ms
70,588 KB
testcase_02 AC 76 ms
70,968 KB
testcase_03 AC 91 ms
74,676 KB
testcase_04 AC 81 ms
74,680 KB
testcase_05 AC 80 ms
74,892 KB
testcase_06 AC 80 ms
74,888 KB
testcase_07 AC 80 ms
74,852 KB
testcase_08 AC 80 ms
74,672 KB
testcase_09 AC 83 ms
74,880 KB
testcase_10 AC 82 ms
74,688 KB
testcase_11 AC 80 ms
74,888 KB
testcase_12 AC 82 ms
74,640 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 352 ms
183,764 KB
testcase_17 AC 369 ms
184,132 KB
testcase_18 AC 361 ms
183,624 KB
testcase_19 WA -
testcase_20 AC 354 ms
183,568 KB
testcase_21 AC 350 ms
183,444 KB
testcase_22 AC 354 ms
183,620 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
testcase_43 AC 345 ms
183,772 KB
testcase_44 AC 355 ms
184,156 KB
testcase_45 AC 77 ms
71,008 KB
testcase_46 AC 76 ms
70,788 KB
testcase_47 AC 76 ms
71,072 KB
testcase_48 AC 77 ms
71,072 KB
testcase_49 AC 75 ms
71,032 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
S = list(str(input()))
MOD = 10**9+7
alp = list(' yukicoder')
M = len(alp)
dp = [[[0,0] for _ in range(11)] for _ in range(N+1)]
dp[0][0][0] = 1

for i in range(1,N+1):
  s = S[i-1]
  for j in range(M):
    dp[i][j][0] = dp[i-1][j][0]
    dp[i][j][1] = dp[i-1][j][1]
  if s != '?':
    for k in range(M):
      if s == alp[k]:
        j = k
        break
    dp[i][j][0] += dp[i-1][j-1][0]
    dp[i][j][0] %= MOD
    dp[i][j][1] += dp[i-1][j-1][1]
    dp[i][j][1] %= MOD
  else:
    for k in range(1,M):
      dp[i][k][1] += dp[i-1][k-1][0]
      dp[i][k][1] %= MOD

print(dp[N][M-1][0]+dp[N][M-1][1])
0