← 返回 amazon 的题目列表Minimum Time for Irrecoverable Password
类型:online_judge
Database security and authentication have become vital due to the increasing number of cyberattacks every day. Amazon has created a team to analyze various types of cyberattacks. In one such analysis, the team finds a virus attacking user passwords. The virus's attacking rule is defined by attackOrder, which is a permutation of length n. In the i-th second of the attack, the virus attacks the attackOrder[i]-th character of the password, replacing it with the malicious character ''. A password is said to be irrecoverable when the number of substrings containing at least one malicious character '' becomes greater than or equal to m. The team wishes to find the minimum time after which the password becomes irrecoverable.
Example
Input
5
bcced
2 3 1 4 5
10