結果

問題 No.1909 Detect from Substrings
ユーザー tassei903tassei903
提出日時 2022-04-22 21:57:16
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 1,115 bytes
コンパイル時間 291 ms
コンパイル使用メモリ 87,276 KB
実行使用メモリ 126,604 KB
最終ジャッジ日時 2023-09-06 08:21:34
合計ジャッジ時間 10,166 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,272 KB
testcase_01 AC 72 ms
71,108 KB
testcase_02 AC 73 ms
71,356 KB
testcase_03 RE -
testcase_04 RE -
testcase_05 AC 122 ms
88,624 KB
testcase_06 AC 169 ms
116,404 KB
testcase_07 AC 175 ms
116,468 KB
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 AC 157 ms
105,500 KB
testcase_19 AC 157 ms
105,056 KB
testcase_20 AC 158 ms
105,224 KB
testcase_21 RE -
testcase_22 RE -
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 RE -
testcase_30 RE -
testcase_31 RE -
testcase_32 RE -
testcase_33 RE -
testcase_34 RE -
testcase_35 RE -
testcase_36 RE -
testcase_37 RE -
testcase_38 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = lambda :sys.stdin.readline()[:-1]
ni = lambda :int(input())
na = lambda :list(map(int,input().split()))
yes = lambda :print("yes");Yes = lambda :print("Yes");YES = lambda : print("YES")
no = lambda :print("no");No = lambda :print("No");NO = lambda : print("NO")
#######################################################################
c = 0
n,m = na()
s = [list(input()) for i in range(n)]
a = s[0]
b = s[1]

for i in range(n):
    if a[i]!=b[i]:
        l = i
        break
for i in range(n-1,-1,-1):
    if a[i]!=b[i]:
        r = i
        break
x = a[:l]+[b[l]]+a[l:]
y = a[:r+1]+[b[r]]+b[r+1:]
ans = 1
for i in range(n):
    t = m+1
    for j in range(m):
        if s[i][j]!=x[j]:
            t = j
            break
    for j in range(t+1,m+1):
        if s[i][j-1]!=x[j]:
            ans = 0
if ans:
    c += 1
ans = 1
for i in range(n):
    t = m+1
    for j in range(m):
        if s[i][j]!=y[j]:
            t = j
            #print(i, j)
            break
    for j in range(t+1,m+1):
        if s[i][j-1]!=y[j]:
            ans = 0
            #print(i,t)
if ans:
    c += 1
print(c)
0