Cooling Pies

The code running well on my System ,But giving me wrong answer when i submit it.Can anybody explain what is wrong with my code.

Here is link of My Code:–>

http://www.codechef.com/viewsolution/6455709

Thanks in Advance

for(j=0;j<N;j++){
scanf("%d",&b[j]);
if(b[j-1]>=b[j] && j!=0)
{
swap=b[j-1];
b[j-1]=b[j];
b[j]=swap;
}
}

What type of sorting is this?
check your solution for the test case

1
1
2 2 2 2
4 2 6 1

The answer should be 3
but your solution will give 4 because the array b[] of your solution is b[]={2,4,1,6}

Can anyone give me more sample cases :::
With input :::

3

3

10 30 20

30 10 20

5

9 7 16 4 8

8 3 14 10 10

4

2 2 2 2

4 2 6 1

I get answer ::

3

4

3

i think i am getting correct answer… Can anyone give a typical test case because when I am submitting my code it is showing wrong answer in codechef