som7's blog

By som7, history, 6 months ago, In English

although i know theres an editorial available , could anyone tell me where does my code actually fail? question — 1003D - Coins and Queries my solution — 142604704

 
 
 
 
  • Vote: I like it
  • +1
  • Vote: I do not like it

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

Check this input:

Input:

It seems, that you don't use coin "4" inside your cycle (:

Fixed solution: 142628659

  • »
    »
    6 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    thanks a lot bro for taking time out! just asking for a suggestion, how did you rectify this test case, i mean i had tried all possible test cases and was getting the right answer everytime. yeah ofcourse, it depends on ones thinking capabilities too, but still any piece of advice on figuring out these tiny errors? also i don't think my solution should be getting a TLE, please help out in this one too, thanks ! 142661957

    • »
      »
      »
      6 months ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      I don't know, that was a second test that came to my mind yesterday :D

      You've made a stupid mistake, another fixed solution: 142682254

      You don't check, that variable 'c' equals to zero after subtraction. In some testcases it leads to infinite loop :)

      • »
        »
        »
        »
        6 months ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        thanks so much brother !