×

 0 Can someone please tell me where i am going wrong? I am getting WA. Following is the link to my code : http://ideone.com/kDW4FE Thanks a lot. asked 20 May '14, 13:07 2★zoey 16●3 accept rate: 0%

 0 You need to sort the array of pies and racks first. The rest of your logic was almost correct. Here is the corrected code - http://www.codechef.com/viewsolution/3927466 answered 20 May '14, 16:09 3.4k●19●43●77 accept rate: 16%
 0 @wittyceaser I used bubble sort to sort the arrays as the input size is limited to 30. answered 21 May '14, 16:25 2★zoey 16●3 accept rate: 0% That's okay. (21 May '14, 16:32) You said that i need to sort the arrays which i did sort ,then why was it giving a wrong answer? Thanks a lot for your help. (21 May '14, 19:21) zoey2★ In the latter part of your code, you have written:  if(w[i]>m[j]) i++;  Basically, if the weight of a pie - i , is greater than the capacity of a rack - j (i.e., w[i] > m[j]), then that rack is not useful for us, so we'll try the next rack. Hence, j++ and not i++. (21 May '14, 19:34) thanks a lot! (21 May '14, 22:37) zoey2★
 toggle preview community wiki:
Preview

By Email:

Markdown Basics

• *italic* or _italic_
• **bold** or __bold__
• 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:

×558
×29

question asked: 20 May '14, 13:07

question was seen: 682 times

last updated: 21 May '14, 22:37