http://codeforces.com/contest/379/problem/C

思路:先排序,然后判断如果rating>ans,ans=rating否则ans++;然后对应的位置输出就可以;

 #include <cstdio>
#include <cstring>
#include <map>
#include <algorithm>
#define LL __int64
#define maxn 500010
using namespace std;
int t;
int n;
LL a[maxn];
LL b[maxn];
struct node
{
LL x;
LL id;
bool operator <(const node &a)const
{
return x<a.x;
}
}p[maxn]; int main()
{
scanf("%d",&n);
for(int i=; i<n; i++)
{
scanf("%I64d",&a[i]);
p[i].x=a[i];
p[i].id=i;
}
sort(p,p+n);
int ans;
ans=b[p[].id]=p[].x;
for(int i=; i<n; i++)
{
if(p[i].x>ans)
{
ans=p[i].x;
b[p[i].id]=ans;
}
else
{
ans++;
b[p[i].id]=ans;
}
}
for(int i=; i<n; i++)
{
if(i==)
printf("%I64d",b[i]);
else
printf(" %I64d",b[i]);
}
printf("\n");
return ;
}

cf C. New Year Ratings Change的更多相关文章

  1. codeforces C. New Year Ratings Change 解题报告

    题目链接:http://codeforces.com/problemset/problem/379/C 题目意思:有n个users,每个user都有自己想升的rating.要解决的问题是给予每个人不同 ...

  2. CF379C-New Year Ratings Change

    https://www.luogu.org/problemnew/show/CF379C 一道水题,折腾了我好久! 解题: 先排序,从小到大挨个满足客户,把最终rating放进集合里,判断是否已经给出 ...

  3. Java和PHP哪个方向更有前途?

      Java和PHP到底哪个方向更有前途呢?我从网络上收集了很多资料,并在这篇文章中做了总结.   1.TIOBE语言排行榜 Apr 2014 Apr 2013 Change Programming ...

  4. TIOBE Index for January 2016(转载)

    Java has won the TIOBE Index programming language award of the year. This is because Java has the la ...

  5. TIOBE Index for December 2015(转载)

    There is hardly any doubt about it, Java will become TIOBE's programming language of the year 2015. ...

  6. TIOBE Index for November 2015(转载)

    原文地址:http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html November Headline: Java once a ...

  7. Good Bye 2013 C

    C. New Year Ratings Change time limit per test 1 second memory limit per test 256 megabytes input st ...

  8. Linux 安装rar解压工具

    下载RAR安装包: http://www.rarsoft.com/download.htm 我的是CentOS 64位: wget http://www.rarsoft.com/rar/rarlinu ...

  9. TIOBE.2017.01最新编程语言排行榜

    Jan 2017     Jan 2016     Change     Programming Language     Ratings     Change1    1        Java   ...

随机推荐

  1. web.xml基本配置描述

    先加载一段写好的web.xml: <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2. ...

  2. NGUI对象跟随鼠标拖拽移动

    public Camera WNGUICamera; Vector3 _WoldPosition;//指针的初始位置 // Vector3 _WoldAng; Vector3 WscreenSpace ...

  3. Linux下生产者与消费者的线程实现

    代码见<现代操作系统> 第3版. 为了显示效果,添加了printf()函数来显示运行效果 #include<stdio.h> #include<pthread.h> ...

  4. Linux 内核的文件 Cache 管理机制介绍-ibm

    https://www.ibm.com/developerworks/cn/linux/l-cache/ 1 前言 自从诞生以来,Linux 就被不断完善和普及,目前它已经成为主流通用操作系统之一,使 ...

  5. 多队列网卡简介以及Linux通过网卡发送数据包源码解读

    http://blog.csdn.net/yanghua_kobe/article/details/7485254 首先我们看一下一个主流多队列网卡(E1000)跟多核CPU之间的关系图: 非多队列: ...

  6. Linux入门基础教程

    转载自:http://www.centoscn.com/CentOS/2015/0528/5555.html 1. 1      Linux操作系统简介 Linux是一套免费使用和自由传播的类Unix ...

  7. POJ 1228 Grandpa's Estate(凸包)

    Grandpa's Estate Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 11289   Accepted: 3117 ...

  8. 洛谷 1503 鬼子进村 (set)

    /*set加速维护*/ #include<iostream> #include<cstdio> #include<cstring> #include<set& ...

  9. PID204 / 特种部队

    /* 双向DP 两条路 f[i][j] 表示第一条路末位置为i 第二条路末位置为j 的最优解 转移:对于下一个点 k=max(i,j)+1 可以更新 路1的末位置 也可以更新路2的末位置 f[i][k ...

  10. composer之安装

    最近想要学习下yii框架,所以,就看了下官网,看到了貌似比较依赖composer这个东西,然后我就安装了,但是会有问题,安装不上等等问题,不论是windows还是linux命令行安装,都是因为一个问题 ...