Codeforces celebrates 10 years! We are pleased to announce the crowdfunding-campaign. Congratulate us by the link https://codeforces.com/10years. ×

Drom's blog

By Drom, history, 12 months ago, ,

Hi codeforces,

I'm trying to solve problem 372A ( Counting Kangaroos is Fun ), but i can't figure out what's wrong with my solution #50057680. What i am trying to do is sort the array and use two pointers to get the answer but i'm stuck on test case 6?

• 0

 » 12 months ago, # |   +1 Your asumation is wrong. For exemple take this test. 4 1 1 2 4Your code gives 3 but the corect answer is 2; I will let you figure it out why.
•  » » 12 months ago, # ^ |   0 Try to find another solution. If not, you can look at the tutorial. It's a easy and corect solution to this.
•  » » 12 months ago, # ^ |   0 I think in the test case you gave the correct answer is indeed 3 ?
•  » » » 12 months ago, # ^ |   0 No, man. 4 takes 1 2 takes 1Total left=2
•  » » » » 12 months ago, # ^ |   +1 The first 4 from the example is the number of Kangaros. The array is 1 1 2 4
•  » » » » » 12 months ago, # ^ | ← Rev. 2 →   0 Oh sorry i see what you mean (i tought you gave 5 capacities)