QOJ.ac

QOJ

Límite de tiempo: 1.0 s Límite de memoria: 1024 MB Puntuación total: 100 Hackeable ✓

#8983. 平庸的字符串问题

Estadísticas

给定两个字符串 $s$ 和 $t$,计算满足以下条件的元组 $(i, j, k)$ 的数量:

  1. $1 \le i \le j \le |s|$
  2. $1 \le k \le |t|$
  3. $j - i + 1 > k$
  4. $s$ 的第 $i$ 个字符到第 $j$ 个字符,与 $t$ 的第 $1$ 个字符到第 $k$ 个字符拼接而成的字符串是一个回文串。

回文串是指正读和反读都相同的字符串,例如 “abcba” 或 “xyzzyx”。

输入格式

第一行包含字符串 $s$ ($2 \le |s| \le 10^6$)。第二行包含字符串 $t$ ($1 \le |t| < |s|$)。$s$ 和 $t$ 均仅包含小写拉丁字母。

输出格式

满足条件的元组数量。

样例

输入 1

ababa
aba

输出 1

5

输入 2

aabbaa
aabb

输出 2

7

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.