結果

問題 No.1702 count good string
ユーザー harurunharurun
提出日時 2021-10-02 02:28:01
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 157 ms / 2,000 ms
コード長 684 bytes
コンパイル時間 680 ms
コンパイル使用メモリ 10,864 KB
実行使用メモリ 8,580 KB
最終ジャッジ日時 2023-09-30 09:42:16
合計ジャッジ時間 5,853 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
7,856 KB
testcase_01 AC 17 ms
7,792 KB
testcase_02 AC 16 ms
7,788 KB
testcase_03 AC 16 ms
7,856 KB
testcase_04 AC 17 ms
7,880 KB
testcase_05 AC 16 ms
7,788 KB
testcase_06 AC 16 ms
7,808 KB
testcase_07 AC 16 ms
7,792 KB
testcase_08 AC 17 ms
7,852 KB
testcase_09 AC 17 ms
7,936 KB
testcase_10 AC 18 ms
7,808 KB
testcase_11 AC 18 ms
7,816 KB
testcase_12 AC 18 ms
7,932 KB
testcase_13 AC 156 ms
8,468 KB
testcase_14 AC 157 ms
8,340 KB
testcase_15 AC 157 ms
8,416 KB
testcase_16 AC 157 ms
8,528 KB
testcase_17 AC 156 ms
8,580 KB
testcase_18 AC 156 ms
8,424 KB
testcase_19 AC 156 ms
8,348 KB
testcase_20 AC 156 ms
8,456 KB
testcase_21 AC 156 ms
8,348 KB
testcase_22 AC 155 ms
8,476 KB
testcase_23 AC 17 ms
8,184 KB
testcase_24 AC 18 ms
8,228 KB
testcase_25 AC 17 ms
8,208 KB
testcase_26 AC 18 ms
8,180 KB
testcase_27 AC 17 ms
8,312 KB
testcase_28 AC 18 ms
8,276 KB
testcase_29 AC 18 ms
8,212 KB
testcase_30 AC 17 ms
8,184 KB
testcase_31 AC 18 ms
8,332 KB
testcase_32 AC 18 ms
8,324 KB
testcase_33 AC 91 ms
8,576 KB
testcase_34 AC 92 ms
8,480 KB
testcase_35 AC 90 ms
8,380 KB
testcase_36 AC 90 ms
8,392 KB
testcase_37 AC 91 ms
8,388 KB
testcase_38 AC 90 ms
8,480 KB
testcase_39 AC 91 ms
8,536 KB
testcase_40 AC 90 ms
8,420 KB
testcase_41 AC 90 ms
8,464 KB
testcase_42 AC 88 ms
8,460 KB
testcase_43 AC 128 ms
8,524 KB
testcase_44 AC 149 ms
8,416 KB
testcase_45 AC 17 ms
7,852 KB
testcase_46 AC 17 ms
7,820 KB
testcase_47 AC 17 ms
7,824 KB
testcase_48 AC 16 ms
7,808 KB
testcase_49 AC 16 ms
7,936 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
  N=int(input())
  S=input()
  dp=[[0]*2 for i in range(9)]
  mod=10**9+7
  u={"y":0,"u":1,"k":2,"i":3,"c":4,"o":5,"d":6,"e":7,"r":8}
  t=list("yukicoder")
  for i in range(N):
    if S[i]==t[0]:
      dp[0][0]+=1
      dp[0][0]%=mod
    elif S[i] in t:
      for j in range(1,9):
        if S[i]==t[j]:
          dp[u[t[j]]][0]+=dp[u[t[j]]-1][0]
          dp[u[t[j]]][0]%=mod
          dp[u[t[j]]][1]+=dp[u[t[j]]-1][1]
          dp[u[t[j]]][1]%=mod
          break
    elif S[i]=='?':
      dp[0][1]+=1
      dp[0][1]%=mod
      for j in range(1,9):
        dp[u[t[j]]][1]+=dp[u[t[j]]-1][0]
        dp[u[t[j]]][1]%=mod
  print((dp[8][0]+dp[8][1])%mod)
  return
  
main()
0