You are not logged in. Please login at to post your questions!


STL Help Required

I'm comparing two vectors in C++ stl for equality;

vector<int> x,y;

using x==y

but getting WA on codechef;

I tried many cases using random generator but working on all.

Consider this link for the code.

I've done this many times before but never got WA.

What could be the reason here?

Btw this could be the only problem because when I did the checking manually it got me an AC.

asked 04 Nov '18, 00:33

arjitkansal's gravatar image

accept rate: 3%

I think there is no problem with STL. Problem is with your logic. Try this test Case 1 4 3 0 0 0 0 0 0 The correct answer is bob but your code output alice. push a only in vector when a > 0. It will give correct answer


answered 04 Nov '18, 00:51

vipin1407's gravatar image

accept rate: 10%

edited 04 Nov '18, 00:54


Damn I didn't see the constraints for the possibility of 0 :(

(04 Nov '18, 08:55) arjitkansal5★

I also get a penalty for this. then I see the constraints and realize that we have heaps that contain 0 stone. seriously who call them a heap. just amazing

(04 Nov '18, 14:48) vipin14074★
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported
  • mathemetical formulas in Latex between $ symbol

Question tags:


question asked: 04 Nov '18, 00:33

question was seen: 191 times

last updated: 04 Nov '18, 14:48