#include<stdio.h>
int main()
{
    int x[500],y[500];
    int a,b,c,d,e;
    scanf("%d",&a);
    for(int i=0;i<a;i++)
    {
        scanf("%d",&x[i]);
    }
    for(int i=a;i>0;i--)
    {
        for(int j=i-1;j>0;j--)
        {
            if()
            if(x[j]-x[i]>0)
            {
                y[i]=j+1;
                break;
            }
            else if(x[j]-x[i]<0)
            {
                y[i]=0;
            }
        }
    }
    for(int i=0;i<a;i++)
    {
        printf("%d ",y[i]);    
    }
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: