当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

6586:String

题目描述
Tom has a string containing only lowercase letters. He wants to choose a subsequence of the string whose length is $k$ and lexicographical order is the smallest. It's simple and he solved it with ease.
But Jerry, who likes to play with Tom, tells him that if he is able to find a lexicographically smallest subsequence satisfying following 26 constraints, he will not cause Tom trouble any more.
The constraints are: the number of occurrences of the $i$th letter from a to z (indexed from $1$ to $26$) must in $[L_i, R_i]$.
Tom gets dizzy, so he asks you for help.
输入解释
The input contains multiple test cases. Process until the end of file.
Each test case starts with a single line containing a string $S(|S|\le 10^5)$and an integer $k(1\le k\le |S|)$.
Then $26$ lines follow, each line two numbers $L_i,R_i(0\le L_i\le R_i\le |S|)$.
It's guaranteed that $S$ consists of only lowercase letters, and $\sum |S|\le 3\times 10^5$.
输出解释
Output the answer string.
If it doesn't exist, output $-1$.
输入样例
aaabbb 3
0 3
2 3
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
输出样例
abb
来自杭电HDUOJ的附加信息
Recommend

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-6586

最后修改于 2020-10-25T23:32:34+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
2000/1000MS(Java/Others) 262144/262144K(Java/Others)