题目链接 http://codeforces.com/problemset/problem/380/B
给出所有人的期望分数,让所有人分数之和最小,且每人分不同
这个,给数字排个序,然后从小开始,看看他和之前那个数的关系,要是小于等于的话,就让这个数字大一点
#include<string.h>
#include<algorithm>
#include<stdio.h>
#include<set>
#include<vector>
#include<iostream>
using namespace std;
#define LL long long
#define P pair<LL, LL>
#define fst first
#define sec second
P num[400000];
LL ans[400000];
int main()
{
int n;
cin >> n;
for(int i = 0; i < n; i++)
{
LL t;
cin >> t;
num[i] = P(t, i);
}
sort(num, num + n);
LL yu = 0;
for(int i = 1; i < n; i++)
{
if(num[i].fst <= num[i - 1].fst)
num[i].fst += - num[i].fst + num[i - 1].fst + 1;
}
for(int i = 0; i < n; i++)
ans[num[i].sec] = num[i].fst;
for(int i = 0; i < n; i++)
cout << ans[i] << " ";
}