結果

問題 No.1909 Detect from Substrings
ユーザー titiatitia
提出日時 2022-04-23 01:18:21
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 688 bytes
コンパイル時間 71 ms
コンパイル使用メモリ 10,832 KB
実行使用メモリ 10,976 KB
最終ジャッジ日時 2023-09-06 12:13:34
合計ジャッジ時間 9,064 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,820 KB
testcase_01 AC 15 ms
7,824 KB
testcase_02 AC 15 ms
7,936 KB
testcase_03 AC 16 ms
7,888 KB
testcase_04 AC 16 ms
8,364 KB
testcase_05 AC 17 ms
8,800 KB
testcase_06 AC 19 ms
9,200 KB
testcase_07 AC 19 ms
9,136 KB
testcase_08 AC 362 ms
10,716 KB
testcase_09 AC 257 ms
10,564 KB
testcase_10 AC 157 ms
9,752 KB
testcase_11 AC 130 ms
9,848 KB
testcase_12 AC 70 ms
9,440 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 #

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

for i in range(N):
    s=S[i]
    ind0=0
    ind1=0
    c=0
    for ind in range(M):
        if s[ind]==T1[i]:
            i+=1
        else:
            c+=1
    if c>=2:
        break
    
else:
    ANS+=1

    
for i in range(N):
    s=S[i]
    ind0=0
    ind1=0
    c=0
    for ind in range(M):
        if s[ind]==T2[i]:
            i+=1
        else:
            c+=1
    if c>=2:
        break
    
else:
    ANS+=1

print(ANS)

    

0