链接:https://codeforces.com/contest/379/problem/C

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.

Examples

input

Copy

3
5 1 1

output

Copy

5 1 2

input

Copy

1
1000000000

output

Copy

1000000000

代码:

#include<bits/stdc++.h>
using namespace std;
long long t,n,k,s,tip;
map<long long ,long long >m;
struct node{long long id,x,y;
}a[10000001];
bool cmp(node p,node q)
{return p.x<q.x;
}
bool bmp(node p,node q)
{return p.id<q.id;
}
int main()
{cin>>n;for(int i=1;i<=n;i++){cin>>a[i].x;a[i].id=i;}sort(a+1,a+1+n,cmp);long long ans=0;for(int i=1;i<=n;i++){if(a[i].x<=ans){a[i].x=ans;ans++;}elseans=a[i].x+1;a[i].y=a[i].x;}sort(a+1,a+1+n,bmp);for(int i=1;i<=n;i++){cout<<a[i].y<<" ";}
}

C. New Year Ratings Change相关推荐

  1. CF 379C New Year Ratings Change

    先根据rate排序,去重,注意可能前面去重后的结果影响到后面的值,因此WA了一次.然后在按序列排序回来. #include<iostream> #include<algorithm& ...

  2. 【IT资讯】TIOBE - 2020年7月编程语言排行

    编程语言排行榜 TOP 20 榜单: 统计编程语言R在本月从第9位升至第8位,创造了新的记录. 不久前,Python似乎赢得了统计编程之战,但是R的流行程度在Python的不断提升中仍在增加.有两种趋 ...

  3. pandas.DataFrame()的基本操作

    感觉上pandas的DataFrame就像numpy中的矩阵,不过它拥有列名和索引名,实际操作起来会更方便一些. 如: df = pd.read_clipboard() df.columns df.R ...

  4. pandas入门学习

    知道pandas主要的数据结构以后就可以实际操作学习了,其实学习主要还是学习如何使用Series和Dataframe的属性和方法使用规则,多使用,多看官方文档就差不多了,下面开始学习pandas: S ...

  5. pandas数据处理实践一(简单走一遍)

    pandas处理数据简单的分为如下步骤: 读取数据-->分析数据-->处理数据-->导出数据 第一次主要是走一个流程 df1 = pd.read_csv('/path/xx.csv' ...

  6. 计算机编程入门语言哪个好?

    计算机编程入门语言哪个好?入门语言有基础的推荐C和JAVA语言,零基础的小伙伴推荐从web前端(网页开发)开始.编程已经没什么新鲜和陌生的了,编程已经进入我们生活的方方面面,那么你知道你编程适合学什么 ...

  7. android卡片风格,[Android] Android 卡片式控件CardView的优雅使用

    [Android] Android 卡片式控件CardView的优雅使用 CardView是在安卓5.0提出的卡片式控件 其具体用法如下: 1.在app/build.gradle 文件中添加 comp ...

  8. 一个程序员给产品经理的话

    ok. 一个标准的产品经理有这么几个技能点,那么作为一个程序员,只能给一些工程技术方面的建议了. 从大体环境上来讲,有操作系统(OS), 数据库,服务器,编程语言.   我的工作大致就是使用编程语言, ...

  9. 第4章 数据获取与存储

    目录 4.1 从csv和txt文件存取数据 4.1.1 csv文件的存取 4.1.1.1 以前学过的python读取csv文件 4.1.1.2 pandas读取csv 4.1.1.3 csv文件的写入 ...

  10. TIOBE 202106 编程语言排行榜(查询网址)

    目录 关于TIOBE 网址 202106 排名情况(TIOBE Index for June 2021) 关于TIOBE TIOBE排行榜   是根据互联网上有经验的程序员.课程和第三方厂商的数量,并 ...

最新文章

  1. [UE4]网游中角色Pawn的移动位置同步以及RTS多角色同时移动的解决方案
  2. JavaEE 资源注入
  3. Python:错误FileNotFoundError: [Errno 2] No such file or directory: 'objects/epsilon.pkl
  4. 谷歌 I/O 2021 在音视频领域中有哪些技术值得被关注?
  5. 解除Linux最大进程数和最大文件句柄打开数限制
  6. CoolFire系列讲座 第2讲
  7. javaWeb随机生成网页验证码图片
  8. python 字符串(二)
  9. 苹果HomeKit生态深度解析,在智能家居领域后发制人?
  10. 关于微信商户企业付款给用户限额问题的说明
  11. varnish 高性能加速器
  12. XP系统添加网络打印机步骤
  13. MySQL的MHA高可用配置及故障切换
  14. 激活各种win 10 系统的方式
  15. jdk11 下载与安装(非常详细,一步不落!!!)
  16. matlab中求立方根,MATLAB基础入门
  17. Mysql学习-第二章(CBO工作原理)
  18. 黑客攻击方式之暴力破解
  19. GPS卫星定位车辆监控系统
  20. 人性化老人手机设计(三)

热门文章

  1. JQuery中三元运算
  2. 1.java基础 jdk,jre,jvm作业 - 答案(jdk,jre,jvm)
  3. IIS短文件名漏洞修复
  4. Backtrader量化平台教程(六)Analyzer
  5. 麒麟子Cocos Creator实用技巧九:棋牌UI全分辨率适配方案
  6. Java 基础知识总结—ArrayList
  7. 计算机分区gpt无法启动项,双系统引导失败怎么修复?用bcd编辑MBR/GPT教程
  8. 利用CH341A编程器刷新BIOS,恢复BIOS,妈妈再也不用担心BIOS刷坏了
  9. lua工具库penlight--06数据(二)
  10. 怎么删除日历每日重复提醒事项