結果

問題 No.1909 Detect from Substrings
ユーザー titiatitia
提出日時 2022-04-23 01:14:42
言語 PyPy3
(7.3.15)
結果
MLE  
実行時間 -
コード長 585 bytes
コンパイル時間 288 ms
コンパイル使用メモリ 87,168 KB
実行使用メモリ 842,100 KB
最終ジャッジ日時 2023-09-06 12:09:08
合計ジャッジ時間 5,005 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,536 KB
testcase_01 AC 71 ms
71,260 KB
testcase_02 AC 70 ms
71,424 KB
testcase_03 AC 72 ms
71,564 KB
testcase_04 AC 75 ms
71,444 KB
testcase_05 AC 76 ms
71,380 KB
testcase_06 AC 79 ms
71,352 KB
testcase_07 AC 78 ms
71,444 KB
testcase_08 MLE -
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 #

import sys
input = sys.stdin.readline

N,M=map(int,input().split())
S=[input().strip() for i in range(N)]

for i in range(M):
    if S[0][i]!=S[1][i]:
        T1=S[0][:i]+S[1][i]+S[0][i:]
        T2=S[1][:i]+S[0][i]+S[1][i:]
        break

ANS=0
SET=set()

for i in range(M+1):
    SET.add(T1[:i]+T1[i+1:])



for i in range(N):
    if S[i] in SET:
        True
    else:
        break
else:
    ANS+=1

    
SET=set()

for i in range(M+1):
    SET.add(T2[:i]+T2[i+1:])



for i in range(N):
    if S[i] in SET:
        True
    else:
        break
else:
    ANS+=1

print(ANS)

    

0