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

×

Pleeeeease tell me what is wrong in this solution

Problem link- Bookshelves

The link to my solution- greedy strategy

Please tell me a counter case which would fail in my solution. Thanks a lot.

asked 28 Aug '17, 21:30

akashbhalotia's gravatar image

4★akashbhalotia
68112
accept rate: 14%

Ok, will see. :D . BTW, what TC's is it failing? All, some , ones with large data?

(28 Aug '17, 21:32) vijju123 ♦♦5★

Here-

Input
5 1 3 5 2 14 1 7 2 3 10 4
Your Output
21
Expected Output
19

We can get a lower output easily. Exchange 14 in upper shelf with 2 in lower shelf. Now upper shelf has elementts 3,5,2,2,1 - max =5. Skew =19.

link

answered 28 Aug '17, 21:42

vijju123's gravatar image

5★vijju123 ♦♦
15.4k12066
accept rate: 18%

edited 28 Aug '17, 21:43

Thanks a lot. I am soooo stupid. I should leave CP.

(28 Aug '17, 21:47) akashbhalotia4★

How did I miss such an obvious case??

(28 Aug '17, 21:48) akashbhalotia4★

Dude, you need to chill. Just thinking too much, on and on and on. Focus on one thing at a time and get it sorted.

(28 Aug '17, 22:36) vijju123 ♦♦5★

Thanks @vijju123

(07 Oct '17, 15:11) akashbhalotia4★
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:

×424

question asked: 28 Aug '17, 21:30

question was seen: 353 times

last updated: 08 Oct '17, 12:47