結果

問題 No.1909 Detect from Substrings
ユーザー 👑 H20H20
提出日時 2022-04-22 22:14:10
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 406 bytes
コンパイル時間 717 ms
コンパイル使用メモリ 87,092 KB
実行使用メモリ 80,920 KB
最終ジャッジ日時 2023-09-06 08:46:27
合計ジャッジ時間 5,471 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,568 KB
testcase_01 AC 71 ms
71,240 KB
testcase_02 AC 71 ms
71,092 KB
testcase_03 AC 72 ms
71,256 KB
testcase_04 AC 74 ms
71,100 KB
testcase_05 AC 71 ms
71,344 KB
testcase_06 AC 72 ms
71,240 KB
testcase_07 AC 73 ms
71,392 KB
testcase_08 AC 86 ms
80,484 KB
testcase_09 AC 86 ms
80,624 KB
testcase_10 AC 71 ms
71,340 KB
testcase_11 AC 71 ms
71,288 KB
testcase_12 AC 73 ms
71,384 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 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M = map(int, input().split())
if N>2:
    print(0)
    exit()
S1 = input()
S2 = input()
ANSSET = set()
T1 = S1[0]+S2
if T1[:M]==S1:
    ANSSET.add(T1)
T2 = S2[0]+S1
if T2[:M]==S2:
    ANSSET.add(T2)


for i1 in range(M):
    if S1[i1]!=S2[i1]:
        break
for i2 in reversed(range(M)):
    if S1[i2]!=S2[i2]:
        break
if i1==i2 and 0<i1<M-1:
    print(1+len(ANSSET))
else:
    print(0+len(ANSSET))
0