結果

問題 No.1909 Detect from Substrings
ユーザー lilictakalilictaka
提出日時 2022-04-22 23:33:39
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 830 bytes
コンパイル時間 255 ms
コンパイル使用メモリ 86,652 KB
実行使用メモリ 87,896 KB
最終ジャッジ日時 2023-09-06 10:28:10
合計ジャッジ時間 6,319 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 82 ms
75,640 KB
testcase_01 AC 82 ms
71,276 KB
testcase_02 AC 81 ms
71,476 KB
testcase_03 AC 288 ms
78,356 KB
testcase_04 AC 283 ms
79,236 KB
testcase_05 AC 303 ms
83,504 KB
testcase_06 AC 337 ms
87,896 KB
testcase_07 AC 266 ms
87,792 KB
testcase_08 TLE -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque
N,M = map(int,input().split())
S = []
def tmp(x):
    return ord(x) -ord('a')
for _ in range(N):
    s = list(map(tmp,list(input())))
    S.append(s)
def check(s,t):
    l = 0
    cnt = 0
    for i in range(len(s)):
        if s[i] == t[l]:
            l += 1
        else:
            l += 1
            if cnt:
                return False
            if s[i] == t[l]:
                l+=1
                cnt += 1
            else:
                return False
    return True
def f(m,x,s0):
    return s0[:m] + [x] + s0[m:]

def allcheck(t):
    for i in range(N):
        if check(S[i],t):
            pass
        else:
            return False
    return True
ans = 0
for m in range(M+1):
    for x in range(26):
        t = f(m,x,S[0])
        if allcheck(t):
            ans += 1
print(ans)
0