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

×

COOLING: Need Algorithm/DS

Can someone tell me what is the name of the Algorithm/DS to be used for this problem ? http://www.codechef.com/problems/COOLING

asked 26 Apr '12, 18:28

exploit's gravatar image

2★exploit
1111
accept rate: 0%

edited 10 Jul '12, 12:39

admin's gravatar image

0★admin ♦♦
19.8k350498541


just try to put pies in increasing order in the racks, you'll get AC. :) (try this)

link

answered 26 Apr '12, 23:37

cyberax's gravatar image

3★cyberax ♦
3.4k21955
accept rate: 20%

edited 27 Apr '12, 06:12

We can maximise the number of pies which can be cooled if we greedily place lowest weight pie on lowest possible rack which can support it and this can be efficiently done if we sort the two arrays you can look at the solution if you want . algorithm : sorting and greedy

link

answered 12 Feb '17, 12:28

hsraktu's gravatar image

4★hsraktu
111
accept rate: 0%

edited 12 Feb '17, 12:33

I suggest you to use Insertion sort to sort the array, since it is efficient enough with small arrays, just like in this example - and it doesn't use recursion, so memory requirements will be quite low.

Here is my solution (though written in Pascal) - that I'm really proud of :D Solution

link

answered 27 Apr '12, 00:38

pera93's gravatar image

2★pera93
1716711
accept rate: 9%

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:

×1,657
×1,477
×554

question asked: 26 Apr '12, 18:28

question was seen: 5,141 times

last updated: 12 Feb '17, 12:33