C. New Year Ratings Change
time limit per test

1 second

memory limit per test

256 megabytes

input

standard input

output

standard output

One very well-known internet resource site (let's call it X) has come up with a New Year adventure. Specifically, they decided to give ratings to all visitors.

There are n users on the site, for each user we know the rating value he wants to get as a New Year Present. We know that user i wants to get at least ai rating units as a present.

The X site is administered by very creative and thrifty people. On the one hand, they want to give distinct ratings and on the other hand, the total sum of the ratings in the present must be as small as possible.

Help site X cope with the challenging task of rating distribution. Find the optimal distribution.

Input

The first line contains integer n (1 ≤ n ≤ 3·105) — the number of users on the site. The next line contains integer sequence a1, a2, ..., an (1 ≤ ai ≤ 109).

Output

Print a sequence of integers b1, b2, ..., bn. Number bi means that user i gets bi of rating as a present. The printed sequence must meet the problem conditions.

If there are multiple optimal solutions, print any of them.

Sample test(s)
input
3
5 1 1
output
5 1 2
input
1
1000000000
output
1000000000
#include <iostream>
#include <stdio.h>
#include <string>
#include <string.h>
#include <algorithm>
#include <stdlib.h>
#include <vector>
using namespace std;
typedef long long LL ; const int Max_N = ;
struct Node{
int num ;
int id ;
friend bool operator < (const Node A ,const Node B){
return A.num < B.num ;
}
};
Node node[Max_N] ;
int ans[Max_N] ; int main(){
int n , i;
scanf("%d",&n) ;
for(i = ; i <= n ; i++){
node[i].id = i ;
scanf("%d",&node[i].num) ;
}
sort(node+ ,node++n) ;
ans[node[].id] = node[].num ;
for(i = ; i <= n ; i++){
if(node[i].num <= node[i-].num)
node[i].num = node[i-].num + ;
ans[node[i].id] = node[i].num ;
}
printf("%d",ans[]) ;
for(i = ; i <= n ; i++)
printf(" %d",ans[i]) ;
puts("") ;
return ;
}

最新文章

  1. c#smtp多线程
  2. bzoj3572又TM是网络流
  3. Areas on the Cross-Section Diagram
  4. 使用POWERDESIGNER设计数据库的20条技巧(转)
  5. 使用powershell为物理网卡添加多个IP地址
  6. java/Android 接口调用的几种写法
  7. Linux MySql install and use with c++
  8. yii学习第一课 《命名空间》
  9. android 解析json数据格式(转)
  10. android 自定义组件
  11. MAC OS下使用Xcode进行GLSL编程的配置过程
  12. 【JavaScript】AJAX总结(异步JavaScript和XML)
  13. 脱机BT transmission
  14. tensorflow分类-【老鱼学tensorflow】
  15. HTML 中使用 JavaScript
  16. flowable6.4.1+springboot使用dmn
  17. clickhouse安装使用文档
  18. rabbitmq使用(三)
  19. Install hadoop on windows(non-virtual machine, such cygwin)
  20. object-c语法

热门文章

  1. WinRT知识积累1之读xml数据
  2. 10-20日 &amp;&amp; 抽签问题
  3. How to implement a custom type for NHibernate property
  4. VIM_git
  5. Javascript 事件对象(二)event事件
  6. 十分钟了解分布式计算:Petuum
  7. LoadRunner常见问题
  8. ThreadPoolExecutor机制探索-我们到底能走多远系列(41)
  9. ctype.h / cctype 中的字符函数
  10. iframe的使用