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 ;
}

Good Bye 2013 C的更多相关文章

  1. Good Bye 2013 A

    A. New Year Candles time limit per test 1 second memory limit per test 256 megabytes input standard ...

  2. Hello world,Hello 2014,Bye 2013

    序 想要写点什么的时候发现不知道写什么了,用一句话来总结2013的话,就是2013是既熟悉又陌生的一年,熟悉是同样的开发工作,陌生是从河南到北京的环境改变,当时大学的卧谈会,谈论毕业了要做什么,想要在 ...

  3. bye 2013 hello 2014

    最近两个月除了必要的工作外,其余时间都在干一些我其实平时很少干的事, 喝酒.唱歌.打麻将.玩牌.以及到处跑找朋友玩,也许是过年的原因我放纵了自己,也许是自己心中的烦恼.我的博客记录着我每次看书学习的笔 ...

  4. Good Bye 2013

    C:有点这种题的经验,先存起来相等的 D:赛后还搓了好久的代码,其实长度就100,枚举两边情况,其实A和C就涵盖了所有情况!所以到2就可以了,而且我弄出了有多少个后,和两边情况,也不知道能否或怎么凑成 ...

  5. codeforces Good Bye 2013 379D New Year Letter

    题目链接:http://codeforces.com/problemset/problem/379/D [题目大意] 告诉你初始字符串S1.S2的长度和递推次数k, 使用类似斐波纳契数列的字符串合并的 ...

  6. CodeForces比赛总结表

    Codeforces A                     B                        C                             D            ...

  7. sqlyog连接Linux上的mysql报错误号码2013,错误号码1130的解决办法

    sqlyog连接Linux上的mysql报错误号码2013,错误号码1130的解决办法 1.报错误号码2013,可能是端口号不是默认的3306,需要改成对应的,检查命令是: [root@host et ...

  8. 2013 Asia Changsha Regional Contest---Josephina and RPG(DP)

    题目链接 http://acm.hdu.edu.cn/showproblem.php?pid=4800 Problem Description A role-playing game (RPG and ...

  9. SharePoint 2013: A feature with ID has already been installed in this farm

    使用Visual Studio 2013创建一个可视web 部件,当右击项目选择"部署"时报错: "Error occurred in deployment step ' ...

随机推荐

  1. Fedora10下建立linux系统的窗口没有地址栏

    Fedora10下建立的linux系统窗口没有地址栏 打开一个文件夹就打开一个窗口,还没有地址栏,这很麻烦也不习惯. 另:打开地址栏可以用组合键 Ctrl+L 如图 解决: edit---perfer ...

  2. KnockOut.js入门示例详解

    KnockOut框架简称KO,是微软将应用于WPF/Silverlight的MVVM模式在Web上的尝试,这是一个非常有用的JavaScript框架. KO的核心就是绑定,包括数据绑定和行为绑定: K ...

  3. 安装debian第一天遇到的几个问题及解决方案

    1.当我想要使用sudo时,提示 bash: sudo: command not found 一开始以为是PATH不对,就各种百度各种试 export PATH=${PATH}:$HOME/bin:/ ...

  4. 深入了解Hibernate的缓存使用

    Hibernate缓存 缓存是计算机领域的概念,它介于应用程序和永久性数据存储源(如在硬盘上的文件或者数据库)之间,其作用是降低应用程序 直接读写永久性数据存储源的频率,从而提高应用的运行性能.缓存中 ...

  5. WINDONWS7+VS2012+Cocos2d-x

    一:准备工作 准备下载文件 1.VS2012,到处都有咱就不发链接了. 2.Cocos2d-x的最新版本 http://www.cocos2d-x.org/projects/cocos2d-x/wik ...

  6. Node.js高级编程读书笔记 - 5 数据库 - Never

    Outline 6 连接数据库 6.1 使用node-mysql连接MySQL数据库 6.2 使用Nano连接CouchDB数据库 6.3 使用Mongoose连接MongoDB数据库 6 连接数据库 ...

  7. Sprint第二个冲刺(第十三天)

    一.Sprint 计划会议: sprint2计划的功能还没有全部完成,还在实现剩余的两个功能模块,目前工作进展还比较顺利,争取下一个sprint完成剩余的所有目标. 以下是真机测试下的拍照和系统相册取 ...

  8. 第一篇T语言实例开发(版本5.3),带错误检测的加减乘除运算器

    带错误检测的加减乘除运算器 表达式 TC综合开发工具里的表达式大体分为:计算表达式.条件表达式 计算表达式: 它一般是用在赋值过程中,或者是和条件表达式混合使用这样的表达式里只有数字运算符(如:+.- ...

  9. JQUERY操作html--获取和设置内容、属性、回调函数

    一:jQuery - 获取内容和属性 1.获得内容 - text().html() 以及 val() text() - 返回所选元素的文本内容 html() - 返回所选元素的内容(包括 HTML 标 ...

  10. chrome 49 版本 跨越 --args --disable-web-security --user-data-dir

    转载: 做前端的,用Ajax获取数据,是常有的事情,同域下自然没问题了,如果是不同域获取数据,浏览器就有个同源策略的限制. 如图: Origin * is not allowed by Access- ...