結果

問題 No.1909 Detect from Substrings
ユーザー 👑 H20H20
提出日時 2022-04-22 22:16:26
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 513 bytes
コンパイル時間 406 ms
コンパイル使用メモリ 86,784 KB
実行使用メモリ 80,608 KB
最終ジャッジ日時 2023-09-06 08:49:03
合計ジャッジ時間 5,316 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,036 KB
testcase_01 AC 71 ms
70,980 KB
testcase_02 AC 70 ms
70,844 KB
testcase_03 AC 69 ms
71,220 KB
testcase_04 AC 70 ms
70,848 KB
testcase_05 AC 71 ms
70,976 KB
testcase_06 AC 70 ms
71,196 KB
testcase_07 AC 69 ms
71,204 KB
testcase_08 AC 88 ms
80,184 KB
testcase_09 AC 86 ms
80,260 KB
testcase_10 AC 71 ms
71,160 KB
testcase_11 AC 70 ms
71,232 KB
testcase_12 AC 69 ms
71,116 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>3:
    print(0)
    exit()
if N==3:
    print(1)
if N==2:
    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