Блог пользователя nipul1

Автор nipul1, история, 5 лет назад, По-английски

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

Thanks in advanced.

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

»
5 лет назад, # |
  Проголосовать: нравится +3 Проголосовать: не нравится

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

»
5 лет назад, # |
Rev. 5   Проголосовать: нравится +4 Проголосовать: не нравится

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