結果
| 問題 | No.1909 Detect from Substrings |
| コンテスト | |
| ユーザー |
lilictaka
|
| 提出日時 | 2022-04-23 00:08:14 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 984 bytes |
| 記録 | |
| コンパイル時間 | 400 ms |
| コンパイル使用メモリ | 85,292 KB |
| 実行使用メモリ | 233,016 KB |
| 最終ジャッジ日時 | 2026-03-10 04:46:12 |
| 合計ジャッジ時間 | 84,251 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 8 WA * 1 TLE * 27 |
ソースコード
from collections import deque
N,M = map(int,input().split())
S = []
def tmp(x):
return ord(x) -ord('a')
for _ in range(N):
s = list(map(tmp,list(input())))
S.append(s)
def change(l,m,s0,x):
if l == m:
cmp = x
elif l < m:
cmp = s0[l]
else:
cmp = s0[l-1]
return cmp
def check(s0,m,x,s):
l = 0
cnt = 0
for i in range(M):
cmp = change(l,m,s0,x)
if cmp == s[i]:
l += 1
else:
l += 1
if cnt :
return False
cmp = change(l,m,s0,x)
if cmp == s[i]:
l += 1
cnt += 1
else:
return False
return True
def allcheck(s0,m,x):
for i in range(1,N):
if check(s0,m,x,S[i]):
pass
else:
return False
return True
ans = 0
for m in range(M+1):
for x in range(26):
if allcheck(S[0],m,x):
ans += 1
print(ans)
lilictaka