CF1187B-Letters Shop(字母商店)(字符串相关)

The letters shop showcase is a string ss, consisting of n lowercase Latin letters. As the name tells, letters are sold in the shop.

字母商店的陈列是一个字符串s,包含n个小写拉丁字母,正如它的名字所说,这个店铺卖字母。

Letters are sold one by one from the leftmost to the rightmost. Any customer can only buy some prefix of letters from the string ss.

字母从最左到最右一个一个的出售,所有顾客都只能从字符串s中买一些前缀。

There are mm friends, the ii-th of them is named titi. Each of them is planning to estimate the following value: how many letters (the length of the shortest prefix) would s/he need to buy if s/he wanted to construct her/his name of bought letters. The name can be constructed if each letter is presented in the equal or greater amount.

有m个朋友,第i个人叫ti,他们中的每个人都打算去估计如下方案的价格:要买多少字母(所需最短前缀长度)他才能用这些买了的字母构造出他的名字。当且仅当库存字母大于或等于所需字母时,名字才可以被表示。

  • For example, for ss="arrayhead" and titi="arya" 5 letters have to be bought ("arrayhead").
  • For example, for ss="arrayhead" and titi="harry" 6 letters have to be bought ("arrayhead").
  • For example, for ss="arrayhead" and titi="ray" 5 letters have to be bought ("arrayhead").
  • For example, for ss="arrayhead" and titi="r" 2 letters have to be bought ("arrayhead").
  • For example, for ss="arrayhead" and titi="areahydra" all 9 letters have to be bought ("arrayhead").

It is guaranteed that every friend can construct her/his name using the letters from the string ss.

题目保证这些人的名字都可以在s中找到构造方案。

Note that the values for friends are independent, friends are only estimating them but not actually buying the letters.

注意每个人的方案估值都是独立的,也就是说他们只评估但实际上不买字母

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值