結果
問題 | No.1702 count good string |
ユーザー | MasKoaTS |
提出日時 | 2021-10-31 17:56:43 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,191 bytes |
コンパイル時間 | 191 ms |
コンパイル使用メモリ | 82,048 KB |
実行使用メモリ | 159,616 KB |
最終ジャッジ日時 | 2024-04-17 11:33:15 |
合計ジャッジ時間 | 15,303 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 141 ms
86,272 KB |
testcase_01 | AC | 149 ms
86,272 KB |
testcase_02 | AC | 156 ms
88,960 KB |
testcase_03 | AC | 158 ms
89,472 KB |
testcase_04 | AC | 155 ms
89,088 KB |
testcase_05 | AC | 152 ms
88,832 KB |
testcase_06 | AC | 156 ms
88,960 KB |
testcase_07 | AC | 156 ms
89,088 KB |
testcase_08 | AC | 155 ms
88,960 KB |
testcase_09 | AC | 157 ms
89,088 KB |
testcase_10 | AC | 157 ms
88,960 KB |
testcase_11 | AC | 156 ms
89,088 KB |
testcase_12 | AC | 155 ms
89,088 KB |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | WA | - |
testcase_29 | AC | 159 ms
89,216 KB |
testcase_30 | WA | - |
testcase_31 | WA | - |
testcase_32 | AC | 160 ms
89,216 KB |
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 | 374 ms
158,720 KB |
testcase_44 | AC | 387 ms
158,720 KB |
testcase_45 | AC | 146 ms
86,272 KB |
testcase_46 | AC | 140 ms
86,272 KB |
testcase_47 | AC | 139 ms
86,272 KB |
testcase_48 | AC | 142 ms
86,016 KB |
testcase_49 | AC | 143 ms
86,016 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(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))