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

×

SPOJ EGGYPIZZA

LINK TO PROBLEM : http://www.spoj.com/problems/EGYPIZZA/

i have solved above problem using frequency array but i read in comments other approaches using set,map,greedy. What are different solution to this problem?

asked 21 Mar '17, 23:25

chunky_2808's gravatar image

3★chunky_2808
1649
accept rate: 4%

edited 21 Mar '17, 23:32


all of them wants his amount of pizza in one slice see this line, it means each friend must be given pizza as only a slice ie if someone wants 1/2 pizza, he should be given 1/2 piece as a whole rather than 2 "1/4" pieces.
So algo works something like this
1. Divide pizza among people wanting 3/4 pizza with 1/4 pizza
2. Divide pizza among people wanting 1/2 pizza with 1/2 pizza
3. Divide pizza among people wanting 1/2 pizza with 2 person that wants 1/4 pizza
4. Divide pizza among 4 people if all wants 1/4 pizza
5. 1 pizza for abotrika

link

answered 22 Mar '17, 00:30

neilit1992's gravatar image

3★neilit1992
1.1k13
accept rate: 20%

1

I know this approach , i am looking for approach other than this

(22 Mar '17, 00:40) chunky_28083★

Search your query through google. There are many different approach already discussed in codechef discussion or you will find many other blogs with good explanation. Just type EGYPIZZA - Pizza

link

answered 21 Mar '17, 23:32

bansal1232's gravatar image

5★bansal1232
2.8k1419
accept rate: 16%

I already googled it but was not able to find any solution other than frequency array.

(21 Mar '17, 23:39) chunky_28083★

I am using the approach described above but my code still gives wrong answer! Can anyone help what's wrong with my code?

link

answered 30 Nov '17, 03:05

dushyant7917's gravatar image

5★dushyant7917
716
accept rate: 0%

edited 02 Dec '17, 22:15

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,138
×1,024
×61

question asked: 21 Mar '17, 23:25

question was seen: 582 times

last updated: 02 Dec '17, 22:15