Rating changes for last rounds are temporarily rolled back. They will be returned soon. ×

nipul1's blog

By nipul1, history, 5 years ago, In English

I am trying Problem . Please Tell me what's wrong in it Submission

Thanks in advanced.

  • Vote: I like it
  • 0
  • Vote: I do not like it

| Write comment?
»
5 years ago, # |
  Vote: I like it +3 Vote: I do not like it

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

»
5 years ago, # |
Rev. 5   Vote: I like it +4 Vote: I do not like it

the issue with your solution is in the part where the current statement is not 'f' and we are not in the base case yet

first : U allow the statement to go left by the indentation no matter what was the previous statement but you can't do this if the previous statement was 'f' as the problem says 'f' have to enclose a statement inside it.

second : when U allow a statement to go left with the indentation U have to stay in this statement as U can do this more than one time and each time will represent different valid indentation for the whole set of statements but in Ur code you do this ans=(ans+solve(index+1,fors-1))%Mod; (index+1 ) is one of ur mistakes here

also I will show the flow of states that get me AC

1- if U have 'f' statement before current statement there is no chance to go left by indentation so go and and add 1 if current is 'f'

2- if there is no 'f' statement right before the current statement, there is 2 cases here

2.1 continue with the same indentation and add 1 to it if current is 'f'

2.2 you can go left by indentation as long as it's > 0 and be careful u will be in the same statement but with different level of indentation

submission : 58186588