You are not logged in. Please login at www.codechef.com 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

5★arjitkansal
1628
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

link

answered 04 Nov '18, 00:51

vipin1407's gravatar image

4★vipin1407
2147
accept rate: 10%

edited 04 Nov '18, 00:54

1

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

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

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
Preview

Follow this question

By Email:

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

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "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:

×2,739
×279
×73

question asked: 04 Nov '18, 00:33

question was seen: 191 times

last updated: 04 Nov '18, 14:48