結果

問題 No.1909 Detect from Substrings
ユーザー 👑 H20H20
提出日時 2022-04-22 22:12:18
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 420 bytes
コンパイル時間 1,431 ms
コンパイル使用メモリ 86,820 KB
実行使用メモリ 80,880 KB
最終ジャッジ日時 2023-09-06 08:43:37
合計ジャッジ時間 5,413 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,476 KB
testcase_01 AC 73 ms
71,540 KB
testcase_02 AC 71 ms
71,324 KB
testcase_03 AC 73 ms
71,124 KB
testcase_04 AC 74 ms
71,312 KB
testcase_05 AC 72 ms
71,152 KB
testcase_06 AC 72 ms
71,108 KB
testcase_07 AC 73 ms
71,412 KB
testcase_08 AC 89 ms
80,548 KB
testcase_09 AC 88 ms
80,704 KB
testcase_10 AC 73 ms
71,408 KB
testcase_11 AC 73 ms
71,440 KB
testcase_12 AC 70 ms
71,524 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)
if len(ANSSET)>0:
    print(len(ANSSET))
    exit()

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:
    print(1)
else:
    print(0)
0