結果

問題 No.1909 Detect from Substrings
ユーザー vwxyzvwxyz
提出日時 2022-05-29 19:13:54
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 325 ms / 2,000 ms
コード長 527 bytes
コンパイル時間 656 ms
コンパイル使用メモリ 11,952 KB
実行使用メモリ 13,256 KB
最終ジャッジ日時 2023-10-21 00:09:59
合計ジャッジ時間 9,032 ms
ジャッジサーバーID
(参考情報)
judge10 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 28 ms
10,132 KB
testcase_01 AC 28 ms
10,132 KB
testcase_02 AC 28 ms
10,132 KB
testcase_03 AC 29 ms
10,144 KB
testcase_04 AC 34 ms
10,232 KB
testcase_05 AC 60 ms
10,692 KB
testcase_06 AC 65 ms
11,208 KB
testcase_07 AC 71 ms
11,208 KB
testcase_08 AC 300 ms
12,992 KB
testcase_09 AC 45 ms
13,256 KB
testcase_10 AC 176 ms
11,640 KB
testcase_11 AC 105 ms
11,640 KB
testcase_12 AC 114 ms
11,376 KB
testcase_13 AC 127 ms
12,992 KB
testcase_14 AC 193 ms
12,992 KB
testcase_15 AC 296 ms
12,992 KB
testcase_16 AC 162 ms
11,376 KB
testcase_17 AC 125 ms
10,976 KB
testcase_18 AC 136 ms
11,184 KB
testcase_19 AC 135 ms
11,208 KB
testcase_20 AC 138 ms
11,208 KB
testcase_21 AC 247 ms
12,992 KB
testcase_22 AC 325 ms
12,992 KB
testcase_23 AC 105 ms
11,904 KB
testcase_24 AC 146 ms
11,904 KB
testcase_25 AC 157 ms
11,376 KB
testcase_26 AC 298 ms
13,256 KB
testcase_27 AC 317 ms
12,992 KB
testcase_28 AC 195 ms
12,992 KB
testcase_29 AC 244 ms
12,992 KB
testcase_30 AC 315 ms
12,992 KB
testcase_31 AC 233 ms
12,992 KB
testcase_32 AC 297 ms
13,256 KB
testcase_33 AC 239 ms
12,992 KB
testcase_34 AC 298 ms
12,992 KB
testcase_35 AC 255 ms
12,992 KB
testcase_36 AC 296 ms
12,992 KB
testcase_37 AC 256 ms
12,992 KB
testcase_38 AC 298 ms
12,992 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
readline=sys.stdin.readline
N,M=map(int,readline().split())
S=[readline().rstrip() for i in range(N)]
for j in range(M):
    if S[0][j]!=S[1][j]:
        break
se=set()
alp=[chr(i) for i in range(97,97+26)]
se.add(S[0][:j]+S[1][j]+S[0][j:])
se.add(S[1][:j]+S[0][j]+S[1][j:])
ans=0
for s in se:
    for i in range(N):
        for j in range(M):
            if S[i][j]!=s[j]:
                break
        else:
            continue
        if S[i]!=s[:j]+s[j+1:]:
            break
    else:
        ans+=1
print(ans)
0