CF452E.Three strings

提高+/省选-

通过率:0%

时间限制:2.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

You are given three strings (_s_1, _s_2, _s_3). For each integer l (1 ≤ l ≤ min(|_s_1|, |_s_2|, |_s_3|) you need to find how many triples (_i_1, _i_2, _i_3) exist such that three strings s__k[i__k... i__k + l - 1] (k = 1, 2, 3) are pairwise equal. Print all found numbers modulo 1000000007 (109 + 7).

See notes if you are not sure about some of the denotions used in the statement.

给你三个字符串 s1s_1、s2s_2、s3s_3。对于每个整数 ll(满足 1≤l≤min⁡(∣s1∣,∣s2∣,∣s3∣)1 \le l \le \min(|s_1|, |s_2|, |s_3|)),你需要计算满足如下条件的三元组 (i1,i2,i3)(i_1, i_2, i_3) 的个数:三个子串 sk[ik…ik+l−1]s_k[i_k \dots i_k + l - 1](其中 k=1,2,3k = 1, 2, 3)两两相等。将所有求得的数值对 10000000071000000007(即 109+710^9 + 7)取模后输出。

若你对题目中使用的某些符号含义不确定,请参阅题末注释。

输入格式

First three lines contain three non-empty input strings. The sum of lengths of all strings is no more than 3·105. All strings consist only of lowercase English letters.

前三行包含三个非空输入字符串。所有字符串的长度之和不超过 3⋅1053 \cdot 10^5。所有字符串仅由小写英文字母组成。

输出格式

You need to output min(|_s_1|, |_s_2|, |_s_3|) numbers separated by spaces — answers for the problem modulo 1000000007 (109 + 7).

你需要输出 min⁡(∣s1∣,∣s2∣,∣s3∣)\min(|s_1|, |s_2|, |s_3|) 个用空格分隔的数——即该问题的答案对 10000000071000000007(109+710^9 + 7)取模的结果。

输入输出样例

  • 输入#1

    abc
    bc
    cbc

    输出#1

    3 1
  • 输入#2

    abacaba
    abac
    abcd

    输出#2

    11 2 0 0

说明/提示

Consider a string t = _t_1_t_2... t|t|, where t__i denotes the i-th character of the string, and |t| denotes the length of the string.

Then t[i... j] (1 ≤ i ≤ j ≤ |t|) represents the string t__i__t__i + 1... t__j (substring of t from position i to position j inclusive).

考虑一个字符串 t=t1t2…t∣t∣t = t_1 t_2 \dots t_{|t|},其中 tit_i 表示字符串的第 ii 个字符,∣t∣|t| 表示字符串的长度。

那么 t[i…j]t[i \dots j](其中 1≤i≤j≤∣t∣1 \le i \le j \le |t|)表示字符串 titi+1…tjt_i t_{i+1} \dots t_j(即字符串 tt 中从位置 ii 到位置 jj(含端点)的子串)。

输入解题思路,AI测评打分。不知道怎么写?

首页