fork download
  1. b[]={-6,3,9,5,3,-7},r[99],s[99],l,i,j,p;
  2. main(){
  3. for(;i<(l=sizeof b/sizeof*b);i++)
  4. for(j=0;j<i;j++)
  5. r[b[i]>=b[j]?i:j]++;
  6. while(i--)s[r[i]]=b[i];
  7. for(i=l;--i;)
  8. for(j=l;--j;)
  9. r[j]-=s[i-1]==s[i]&r[j]>=i;
  10. while(p<l)printf("%d ",r[p++]+1);
  11. }
  12.  
Success #stdin #stdout 0s 9424KB
stdin
Standard input is empty
stdout
2 3 5 4 3 1