CF79C.Beaver
普及+/提高
通过率:0%
时间限制:2.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
After Fox Ciel got off a bus, she found that the bus she was on was a wrong bus and she lost her way in a strange town. However, she fortunately met her friend Beaver Taro and asked which way to go to her castle. Taro's response to her was a string s, and she tried to remember the string s correctly.
However, Ciel feels n strings _b_1, _b_2, ... , b__n are really boring, and unfortunately she dislikes to remember a string that contains a boring substring. To make the thing worse, what she can remember is only the contiguous substring of s.
Determine the longest contiguous substring of s that does not contain any boring string, so that she can remember the longest part of Taro's response.
狐狸雪儿下车后,发现自己坐错了公交车,在一座陌生的城镇里迷了路。幸运的是,她遇到了朋友河狸太郎,并向他询问前往自己城堡的方向。太郎给她的回答是一串字符串 s,而雪儿努力想准确记住这串字符串 s。
然而,雪儿觉得 n 个字符串 b1, b2, …, bn 极其无聊;不幸的是,她讨厌记住任何包含无聊子串的字符串。更糟糕的是,她只能记住 s 的某个连续子串。
请找出 s 的最长连续子串,使得该子串不包含任意一个无聊字符串(即对所有 i=1,2,…,n,该子串中都不出现 bi 作为子串),从而让她能记住太郎回答中最长的一部分。
输入格式
In the first line there is a string s. The length of s will be between 1 and 105, inclusive.
In the second line there is a single integer n (1 ≤ n ≤ 10). Next n lines, there is a string b__i (1 ≤ i ≤ n). Each length of b__i will be between 1 and 10, inclusive.
Each character of the given strings will be either a English alphabet (both lowercase and uppercase) or a underscore ('_') or a digit. Assume that these strings are case-sensitive.
第一行是一个字符串 s,其长度在 1 到 105 之间(含端点)。
第二行是一个整数 n(1≤n≤10)。接下来的 n 行中,每行给出一个字符串 bi(1≤i≤n),每个 bi 的长度在 1 到 10 之间(含端点)。
所有给定字符串中的字符均为英文字母(区分大小写)、下划线(\_)或数字。注意这些字符串是大小写敏感的。
输出格式
Output in the first line two space-separated integers len and pos: the length of the longest contiguous substring of s that does not contain any b__i, and the first position of the substring (0-indexed). The position pos must be between 0 and |s| - len inclusive, where |s| is the length of string s.
If there are several solutions, output any.
第一行输出两个用空格分隔的整数 len 和 pos:字符串 s 中不包含任意 b__i 的最长连续子串的长度,以及该子串的起始位置(0-索引)。位置 pos 必须满足 0≤pos≤∣s∣−len,其中 ∣s∣ 表示字符串 s 的长度。
若存在多个解,输出任意一个即可。
输入输出样例
输入#1
Go_straight_along_this_street 5 str long tree biginteger ellipse
输出#1
12 4
输入#2
IhaveNoIdea 9 I h a v e N o I d
输出#2
0 0
输入#3
unagioisii 2 ioi unagi
输出#3
5 5
说明/提示
In the first sample, the solution is traight_alon.
In the second sample, the solution is an empty string, so the output can be «0 0», «0 1», «0 2», and so on.
In the third sample, the solution is either nagio or oisii.
在第一个样例中,解为 straight_alon。
在第二个样例中,解为空字符串,因此输出可以是 0 0、0 1、0 2 等。
在第三个样例中,解为 nagio 或 oisii。
输入解题思路,AI测评打分。不知道怎么写?