题目传送门
/*
水题:开个结构体,rk记录排名,相同的值有相同的排名
*/
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <string>
#include <iostream>
#include <queue>
#include <map>
#include <vector>
using namespace std;
const int MAXN = 2e3 + ;
const int INF = 0x3f3f3f3f;
struct A
{
int v, id, rk;
}a[MAXN];
bool cmp_v(A x, A y) {return x.v > y.v;}
bool cmp_id(A x, A y) {return x.id < y.id;}
int main(void) //Codeforces Round #307 (Div. 2) A. GukiZ and Contest
{
// freopen ("A.in", "r", stdin);
int n;
while (scanf ("%d", &n) == )
{
for (int i=; i<=n; ++i)
{
scanf ("%d", &a[i].v); a[i].id = i;
}
sort (a+, a++n, cmp_v);
int cnt = ; a[].v = a[].v; a[].rk = ;
for (int i=; i<=n; ++i)
{
if (a[i].v < a[i-].v)
{
a[i].rk = cnt++;
}
else
{
a[i].rk = a[i-].rk; cnt++;
}
}
sort (a+, a++n, cmp_id);
for (int i=; i<=n; ++i)
{
printf ("%d%c", a[i].rk, (i==n) ? '\n' : ' ');
}
}
return ;
}