A11757 | Scissors
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
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?
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?
输入格式
The first line contains three integers $n$ , $m$ , $k$ $(2<=m<=2·k<=n<=5·10^{5})$ — 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.
The next two lines feature $s$ and $t$ consisting of lowercase latin letters.
输出格式
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.
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.
输入输出样例
输入 #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.
In the second sample case the resulting string is bccb.
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted