結果
問題 | No.1702 count good string |
ユーザー | MasKoaTS |
提出日時 | 2021-10-31 18:04:15 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 404 ms / 2,000 ms |
コード長 | 1,203 bytes |
コンパイル時間 | 451 ms |
コンパイル使用メモリ | 82,072 KB |
実行使用メモリ | 159,284 KB |
最終ジャッジ日時 | 2024-10-09 05:45:34 |
合計ジャッジ時間 | 14,073 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 127 ms
86,460 KB |
testcase_01 | AC | 126 ms
86,016 KB |
testcase_02 | AC | 127 ms
86,400 KB |
testcase_03 | AC | 140 ms
89,344 KB |
testcase_04 | AC | 139 ms
89,088 KB |
testcase_05 | AC | 140 ms
89,344 KB |
testcase_06 | AC | 140 ms
88,960 KB |
testcase_07 | AC | 138 ms
89,084 KB |
testcase_08 | AC | 135 ms
89,344 KB |
testcase_09 | AC | 139 ms
89,076 KB |
testcase_10 | AC | 136 ms
89,344 KB |
testcase_11 | AC | 143 ms
88,960 KB |
testcase_12 | AC | 138 ms
89,356 KB |
testcase_13 | AC | 385 ms
159,280 KB |
testcase_14 | AC | 379 ms
159,168 KB |
testcase_15 | AC | 397 ms
158,848 KB |
testcase_16 | AC | 380 ms
158,720 KB |
testcase_17 | AC | 377 ms
158,976 KB |
testcase_18 | AC | 393 ms
158,976 KB |
testcase_19 | AC | 381 ms
158,720 KB |
testcase_20 | AC | 385 ms
158,976 KB |
testcase_21 | AC | 392 ms
158,848 KB |
testcase_22 | AC | 404 ms
158,880 KB |
testcase_23 | AC | 141 ms
89,216 KB |
testcase_24 | AC | 141 ms
89,212 KB |
testcase_25 | AC | 142 ms
89,556 KB |
testcase_26 | AC | 141 ms
89,344 KB |
testcase_27 | AC | 139 ms
89,472 KB |
testcase_28 | AC | 141 ms
89,588 KB |
testcase_29 | AC | 145 ms
89,344 KB |
testcase_30 | AC | 141 ms
89,088 KB |
testcase_31 | AC | 141 ms
89,472 KB |
testcase_32 | AC | 142 ms
89,216 KB |
testcase_33 | AC | 377 ms
158,720 KB |
testcase_34 | AC | 363 ms
158,920 KB |
testcase_35 | AC | 367 ms
159,016 KB |
testcase_36 | AC | 367 ms
158,976 KB |
testcase_37 | AC | 369 ms
158,720 KB |
testcase_38 | AC | 364 ms
158,976 KB |
testcase_39 | AC | 367 ms
158,848 KB |
testcase_40 | AC | 372 ms
158,976 KB |
testcase_41 | AC | 370 ms
158,848 KB |
testcase_42 | AC | 370 ms
159,284 KB |
testcase_43 | AC | 373 ms
158,720 KB |
testcase_44 | AC | 378 ms
158,720 KB |
testcase_45 | AC | 128 ms
86,272 KB |
testcase_46 | AC | 126 ms
86,272 KB |
testcase_47 | AC | 127 ms
86,528 KB |
testcase_48 | AC | 128 ms
86,560 KB |
testcase_49 | AC | 125 ms
86,080 KB |
ソースコード
import itertools as iter import collections as coll import heapq as hq import bisect as bis from decimal import Decimal as dec from copy import deepcopy as dcopy import math import sys sys.setrecursionlimit(10**6) def input(): return sys.stdin.readline().rstrip() def getN(): return int(sys.stdin.readline().rstrip()) def getNs(): return map(int,sys.stdin.readline().rstrip().split()) def getList(): return list(map(int,sys.stdin.readline().rstrip().split())) def strinps(n): return [sys.stdin.readline().rstrip() for _ in range(n)] pi = 3.141592653589793 mod = 10**9+7 MOD = 998244353 INF = math.inf dx = [1,0,-1,0]; dy = [0,1,0,-1] """ Main Code """ n = getN() s = input() words = ["yukicoder","?ukicoder","y?kicoder","yu?icoder","yuk?coder","yuki?oder","yukic?der","yukico?er","yukicod?r","yukicode?"] def calc_dp(w): dp = [[0]*n for _ in range(9)] if(s[0] == w[0]): dp[0][0] = 1 for i in range(1,n): if(s[i] == w[0]): dp[0][i] = (dp[0][i-1] + 1) % mod else: dp[0][i] = dp[0][i-1] for j in range(1,9): if(s[i] == w[j]): dp[j][i] = (dp[j][i-1] + dp[j-1][i-1]) % mod else: dp[j][i] = dp[j][i-1] return dp[8][n-1] print(sum(calc_dp(w) for w in words) % mod)