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

×

Binary Search , How to Crack

0
1

Problem link : http://www.codechef.com/CDBR2015/problems/CDBSTR1

Every one applying binary Search in the above problem.Can anyone explain me the logic?? How to solve this problem??

asked 12 Feb '15, 02:03

n1n1_4's gravatar image

5★n1n1_4
844622
accept rate: 50%


In this question the maximum answer can be (smallest +largest)/number of cars packed (it can be less But can never be greater then this) and minimum is 1. So start with a mid value=(max+min)/2. And do binary search . If the result is true increment left and other wise decrement right . Take the maximum of the answer and this will be right then .

After doing this, do this one . Uses Binary search .This will help you

http://www.iarcs.org.in/inoi/online-study-material/problems/post-election-transfers.php

Cheers

link

answered 12 Feb '15, 09:49

adityakhanna1999's gravatar image

1★adityakhanna1999
1315
accept rate: 14%

(12 Feb '15, 16:47) n1n1_45★

Welcome , ever ready to help . Thanks for upvote .

link

answered 12 Feb '15, 17:01

adityakhanna1999's gravatar image

1★adityakhanna1999
1315
accept rate: 14%

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:

×3,614
×980
×294

question asked: 12 Feb '15, 02:03

question was seen: 874 times

last updated: 12 Feb '15, 17:01