Tahseen Amra shobai Raja
Limits 1s, 512 MB

There's a hidden treasure in a castle. There are nn guards protecting the treasure. But the guards are not very sincere. They sometimes go outside the castle and walk around. Unfortunately, there's a thief waiting right outside the castle. The thief can only steal the treasure when there are less than 44 guards inside the castle. Given the information about when the guards went outside and when they came back inside, you need to tell whether the thief successfully stole the treasure. Note that, in the beginning, all nn guards were inside.


The first line contains two integers nn(4n100)( 4 \leq n \leq 100) and mm(0m100)(0 \leq m \leq 100)— number of guards, and number of activities respectively.

Each of the next mm lines contains a string. The string is either “out” (one of the guards went outside) or “in” (one of the guards came back inside). It is guaranteed that at least one guard was outside before any “in” string occurs in the input, and at least one guard was inside before any “out“ string.


Print YES if the thief successfully stole the treasure, otherwise print NO.


5 2


Login to submit.


90% Solution Ratio
fakhrulsojibEarliest, 5M ago
abu_fayeemFastest, 0.0s
habib036Lightest, 5.4 kB
SabbasachiSutradharShortest, 139B
Toph uses cookies. By continuing you agree to our Cookie Policy.