CF1313E Concatenation with intersection
题目描述
给定三个串 $a,b,s$,其中 $a,b$ 长度为 $n$,$s$ 长度为 $m$,求出四元组 $(l1,r1,l2,r2)$ 的个数,满足:
1. $[l1,r1]$ 和 $[l2,r2]$ 的交集非空。
2. $a$ 中位置 $l1$ 到 $r1$ 组成的子串与 $b$ 中位置 $l2$ 到 $r2$ 组成的子串拼起来恰好是 $s$。
$1 \leq n \leq 500000$,$2 \leq m \leq 2n$。
输入格式
无
输出格式
无
说明/提示
Let's list all the pairs of segments that Vasya could choose in the first example:
1. $ [2, 2] $ and $ [2, 5] $ ;
2. $ [1, 2] $ and $ [2, 4] $ ;
3. $ [5, 5] $ and $ [2, 5] $ ;
4. $ [5, 6] $ and $ [3, 5] $ ;