hg11110000's blog

https://codeforces.com/contest/1509/problem/B --> Can anyone help in telling in which test case this solution gives wrong answer ??

By hg11110000, history, 4 weeks ago, In English

https://codeforces.com/contest/1509/submission/113240196

My logic :-

At a particular position of M...i saw whether there are atleast required number of T's in left and right

 
 
 
 
  • Vote: I like it
  • -27
  • Vote: I do not like it

»
4 weeks ago, # |
  Vote: I like it +5 Vote: I do not like it

It will be better if you shared your logic rather than your code. It's hard to review someone else's code.

»
4 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

Auto comment: topic has been updated by hg11110000 (previous revision, new revision, compare).

»
4 weeks ago, # |
Rev. 3   Vote: I like it 0 Vote: I do not like it

the number of 'T's are not "static", as a new 'M' is encountered, a 'T' from the prefix is consumed. Similarly you can reverse the string again do the process described above. This will check if we have sufficient number of 'T's after a certain 'M'.

Further, it's obvious that a string that start with 'M' or ends with 'M' is invalid.

You can check this for reference.

  • »
    »
    4 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    i did this from reverse also !!

    revtpos and revmpos vectors...

    That is what confusing me...if am doing it in O(1) and not taking array its passing but O(N) failing !

    Am not getting the mistake :(

»
4 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it
  • »
    »
    4 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    No mine will pass for that case also bro...in which u were failing...

»
4 weeks ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

Yes, I can help. Your solution gives wrong answer at second test case. :)

  • »
    »
    4 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    yeah i know this...which in 2nd test case it gives wrong ?

    some 160th out of 5000

    in which example it can fail...can u tell this please ?

»
4 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

Try this:

1
12
TMMTTTTTTMMT