risingsameep's blog

By risingsameep, 13 years ago, In English

I got wrong answer on pretest 10, but I am unable to find any mistake in my code. Please help me find the mistake. This is my submission

http://codeforces.me/contest/358/submission/4890605

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

»
13 years ago, hide # |
← Rev. 2  
Vote: I like it 0 Vote: I do not like it

Empty Stack... You are trying pop element from stack while stack is empty :)

  • »
    »
    13 years ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it

    Thanks for the reply. But I don't think that such a case should occur.

    I have taken care of it in the code. Could you please point out why this could be happening in the code?

»
13 years ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Here is a test for you

8
1 
2 
3 
1 
2 
3 
0 
0
  • »
    »
    13 years ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it

    My output which seems correct to me: pushStack pushQueue pushFront pushStack pushQueue pushFront 3 popStack popQueue popFront 3 popStack popQueue popFront

    • »
      »
      »
      13 years ago, hide # ^ |
       
      Vote: I like it 0 Vote: I do not like it

      Stack,Queue and Deck are empty after command 0, so you cannot pop something from them

      • »
        »
        »
        »
        13 years ago, hide # ^ |
         
        Vote: I like it +6 Vote: I do not like it

        oh! I missed this part of the question "then empty all containers"!!

        I actually solved a tougher problem.

        Thanks for pointing that out.