Can anyone help me in otimising my solution for CHEFPAT

Question Link - CodeChef: Practical coding for everyone

#include <bits/stdc++.h>
using namespace std;

int main() {
int T;
cin >> T;
while(T>0)
{
int a;
scanf(“%d”,&a);
int arr[a];
int dup[a];
int hmm[a];
for (int i = 0;i<a;i++)
{
scanf(“%d”,&arr[i]);
dup[i] = arr[i];
}
sort(dup,dup+a);
int wow = 1;
for(int i = 0;i<a;i++)
{
int x = distance(arr, find(arr, arr + a, dup[a-wow]));
hmm[x] = wow;
arr[x] = 0;
wow++;
}
for(int i = 0;i<a;i++)
{
printf(“%d”,hmm[i]);
printf(“%s”," “);
}
printf(”%s",“\n”);
T–;
}
}

I am getting TLE, any help would be appreciated.