結果
問題 | No.1005 BOT対策 |
ユーザー |
![]() |
提出日時 | 2025-03-31 17:19:03 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 667 bytes |
コンパイル時間 | 424 ms |
コンパイル使用メモリ | 82,628 KB |
実行使用メモリ | 54,688 KB |
最終ジャッジ日時 | 2025-03-31 17:19:43 |
合計ジャッジ時間 | 2,466 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 20 WA * 8 |
ソースコード
s = input().strip()t = input().strip()m = len(t)n = len(s)if m == 0 or n < m:print(0)exit()intervals = []for i in range(n - m + 1):substr = s[i:i+m]if substr == t:start = iend = i + m - 1intervals.append((start, end))if not intervals:print(0)else:# Sort intervals by their end positionsintervals.sort(key=lambda x: x[1])count = 0last_point = -1 # Tracks the last position where a '.' was insertedfor start, end in intervals:if start > last_point:count += 1last_point = end # Insert '.' at the end of this interval to break Tprint(count)