|
|||
The great kidnappingAfter the voting in the previous exercises, the attackers were able to successfully kidnap the most clever member of each team. Following this, they used military-grade mind altering techniques on the remaining members, so that they completely forget that this +1 person even existed. The goal of the attackers is to create a super clever team from the kidnapped people and reach world dominance! Luckily when the system administrators used backups to restore every data from the previous cyber attacks they noticed some logs which proved that each team had one extra members. However we have no information regarding where this extra person is and how long will they stay there. But luckily during the escape, one of the attackers left a note which lets you calculate how many days you have until the memory altering techniques can completely overwrite your kidnapped teammates' mind and make them "one of the criminals". InputThe input consists of two lines, each closed by an end of line character.
OutputThe output is a single positive integer based on the following:
Example
Input:
Explanation
In the first case we are searching for a 2-long consecutive
subsequence, since the attackers want to hide for 2 days only. The
consecutive subsequences are the following: [3,7], [7,6], [6,3]. The
first and last are okay in terms of the available money (which is
10), but the cheapest possibility is the [6,3], which requires 9
money. So we return 9. |
|||
University of Debrecen; Faculty of Informatics; v. 09/30/2024 |