ABC452D No-Subsequence Substring

https://vjudge.net/problem/AtCoder-abc452_d

首先转化为求包含 \(T\) 的子串数量。枚举左端点 \(l\),找到最小的 \(r\) 使得 \(S[l..r]\) 包含 \(T\),对答案的贡献为 \(n - r + 1\)。时间复杂度 \(O(|S||T|)\)

posted @ 2026-04-04 23:16  dropconst  阅读(18)  评论(0)    收藏  举报