結果
| 問題 |
No.1909 Detect from Substrings
|
| コンテスト | |
| ユーザー |
gew1fw
|
| 提出日時 | 2025-06-12 19:55:52 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
MLE
|
| 実行時間 | - |
| コード長 | 976 bytes |
| コンパイル時間 | 153 ms |
| コンパイル使用メモリ | 81,672 KB |
| 実行使用メモリ | 847,596 KB |
| 最終ジャッジ日時 | 2025-06-12 19:56:44 |
| 合計ジャッジ時間 | 5,206 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 5 MLE * 1 -- * 30 |
ソースコード
def main():
import sys
input = sys.stdin.read().split()
idx = 0
N = int(input[idx])
idx += 1
M = int(input[idx])
idx += 1
S = []
for _ in range(N):
S.append(input[idx])
idx += 1
first = S[0]
candidates = set()
for i in range(M+1):
for c in 'abcdefghijklmnopqrstuvwxyz':
newT = first[:i] + c + first[i:]
candidates.add(newT)
count = 0
for T in candidates:
valid = True
for s in S:
if len(s) != M or len(T) != M + 1:
valid = False
break
i = 0 # pointer for T
j = 0 # pointer for s
while i < len(T) and j < len(s):
if T[i] == s[j]:
j += 1
i += 1
if j != len(s):
valid = False
break
if valid:
count += 1
print(count)
if __name__ == "__main__":
main()
gew1fw