All submissions for this problem are available.
A boy is walking a tightrope .
While walking, he either bends left or right to balance himself. If the boy bends by more than a certain angle, he falls down.
The boy bends by a fixed angle everytime he decides to bend. (Same magnitude of the angle on the left side as well as right)
Given the series of bends performed by the boy, find out whether he completes walking the tightrope entirely or not.
The bending angle of the boy is A.
The threshold of falling down is F, i.e. if the boy's current angle is greater than or equal to F, he falls down.
The input is described by 3 lines.
First line contains an integer N length of the string containing the series of bends.
Second line has a string S containing L's and R's denoting the sequence in which the boy bent on either side.
Third line contains 2 space-separated real numbers A and F.
Print 'YES' (without the quotes) if the boy is able to walk the tightrope entirely, else print 'NO' (without the quotes).
1 ≤ N ≤ 10^6
1 ≤ A ≤ 10^9
1 ≤ F ≤ 10^9
Input 1: 6 LRLRLR 3.0 4.0 Output 1: YES Input 2: 6 LRLRRR 3.0 4.0 Output 2: NO
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
Fetching successful submissions