CF955D.Scissors

省选/NOI-

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

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

题目描述

Jenya has recently acquired quite a useful tool — k-scissors for cutting strings. They are generally used for cutting out two non-intersecting substrings of length k from an arbitrary string s (its length should be at least 2·k in order to perform this operation) and concatenating them afterwards (preserving the initial order). For example, with the help of 2-scissors you can cut ab and de out of abcde and concatenate them into abde, but not ab and bc since they're intersecting.

It's a nice idea to test this tool before using it in practice. After looking through the papers, Jenya came up with two strings s and t. His question is whether it is possible to apply his scissors to string s such that the resulting concatenation contains t as a substring?

珍雅最近获得了一个非常实用的工具——k-剪刀,用于切割字符串。该工具通常用于从任意字符串 $ s $(其长度至少为 $ 2k $,才能执行此操作)中切下两个不相交的、长度均为 $ k $ 的子串,并将它们按原始顺序拼接起来。例如,使用 2-剪刀可以从字符串 abcde 中切下 ab 和 de,然后拼接成 abde;但不能切下 ab 和 bc,因为它们相交。

在实际使用前,对这一工具进行测试是个不错的主意。翻阅资料后,珍雅提出了两个字符串 $ s $ 和 $ t $。他想问:能否对字符串 $ s $ 应用该剪刀操作,使得最终拼接得到的字符串包含 $ t $ 作为其子串?

输入格式

The first line contains three integers n, m, k (2 ≤ m ≤ 2·k ≤ n ≤ 5·105) — length of s, length of t and the aforementioned scissors' parameter correspondingly.

The next two lines feature s and t consisting of lowercase latin letters.

第一行包含三个整数 nn、mm、kk(满足 2 ≤ m ≤ 2⋅k ≤ n ≤ 5⋅1052 ≤ m ≤ 2·k ≤ n ≤ 5·10^5),分别表示字符串 ss 的长度、字符串 tt 的长度,以及前述剪刀操作的参数 kk。

接下来两行分别为由小写拉丁字母组成的字符串 ss 和 tt。

输出格式

If there is no answer, print «No».

Otherwise print «Yes» and two integers L and R denoting the indexes where cutted substrings start (1-indexed). If there are several possible answers, output any.

如果没有答案,输出 «No»。

否则输出 «Yes» 和两个整数 L 和 R,表示被截取的子字符串的起始位置(从 1 开始计数)。如果存在多个可能的答案,输出任意一个即可。

输入输出样例

  • 输入#1

    7 4 3
    baabaab
    aaaa

    输出#1

    Yes
    1 5
  • 输入#2

    6 3 2
    cbcbcb
    bcc

    输出#2

    Yes
    2 5
  • 输入#3

    7 5 3
    aabbaaa
    aaaaa

    输出#3

    No

说明/提示

In the first sample case you can cut out two substrings starting at 1 and 5. The resulting string baaaab contains aaaa as a substring.

In the second sample case the resulting string is bccb.

在第一个样例中,你可以切下两个分别起始于位置 1 和 5 的子串。所得字符串 baaaab 包含 aaaa 作为其子串。

在第二个样例中,所得字符串为 bccb。

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

首页