different output in ideone and codeblock

S

Shao Miller

B

Barry Schwarz

i was doing this question
www.codechef.com/problems/CTEAMS

and this is my oode
http://ideone.com/m2j5GJ
output has some problem i guess..in codeblocks its giving the same answer as on codechef but in ideone output is different..

Your use of meaningless variable names, poor indenting style, and the
complete lack of horizontal white space makes your code damn difficult
to read.

As near as I can tell, as each chef arrives you add him to the array
of chefs sorted by age. This part seems OK.

I don't think your test for where to split the chefs into two teams is
correct. You should be looking for the point that minimizes the
difference between the teams. Your code seems to look for the point
one team is more than half the total. But the minimum could occur one
chef "earlier". This should involve using the abs function.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top