Carvans Problem -- Why I am getting an wrong answer?

Here is the code for the Carvans …

#include <iostream>
using namespace std;


int main() {
int t;
cin>>t;
while(t>0)
{
    int N;
    cin>>N;
    if(N==0)
    {
        cout<<"0"<<endl;
        break;
    }
    int speed[N];
    for(int i=0;i<N;i++)
        cin>>speed[i];
    int maxspeed=1;
    for(int i=0,j=i+1;i<N,j<N;i++,j++)
    {
        if(speed[i]>speed[j])
            maxspeed++;
    }
    cout<<maxspeed<<endl;
    maxspeed=0;
    t--;
}
	return 0;
}

Its showing wrong Answer . Can any body help me what’s wrong in this code or my
understanding in the problem ???

Try to make it simple.
There is no need for a two-pointer method.

Have a look at my submission:
https://www.codechef.com/viewsolution/28589976

Okay I was ignoring the else part if the car cannot overtake then the car with high speed should low down its speed to car it should overtake …

Thanks for the Help !!!

:raised_hands: