A. GukiZ and Contest

Time Limit: 20 Sec

Memory Limit: 256 MB

题目连接

http://codeforces.com/contest/551/problem/A

Description

Professor GukiZ likes programming contests. He especially likes to rate his students on the contests he prepares. Now, he has decided to prepare a new contest.

In total, n students will attend, and before the start, every one of them has some positive integer rating. Students are indexed from 1 to n. Let's denote the rating of i-th student as ai. After the contest ends, every student will end up with some positive integer position. GukiZ expects that his students will take places according to their ratings.

He thinks that each student will take place equal to . In particular, if student A has rating strictly lower then student B, A will get the strictly better position than B, and if two students have equal ratings, they will share the same position.

GukiZ would like you to reconstruct the results by following his expectations. Help him and determine the position after the end of the contest for each of his students if everything goes as expected.

Input

The first line contains integer n (1 ≤ n ≤ 2000), number of GukiZ's students.

The second line contains n numbers a1, a2, ... an (1 ≤ ai ≤ 2000) where ai is the rating of i-th student (1 ≤ i ≤ n).

Output

In a single line, print the position after the end of the contest for each of n students in the same order as they appear in the input.

Sample Input

3
1 3 3

Sample Output

3 1 1

HINT

题意

给这n个学生排名

题解:

排个序,撸一遍就好了

代码:

#include <cstdio>
#include <cmath>
#include <cstring>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <set>
#include <vector>
#include <sstream>
#include <queue>
#include <typeinfo>
#include <fstream>
#include <map>
#include <stack>
typedef long long ll;
using namespace std;
//freopen("D.in","r",stdin);
//freopen("D.out","w",stdout);
#define sspeed ios_base::sync_with_stdio(0);cin.tie(0)
#define test freopen("test.txt","r",stdin)
#define maxn 2000001
#define mod 10007
#define eps 1e-9
const int inf=0x3f3f3f3f;
const ll infll = 0x3f3f3f3f3f3f3f3fLL;
inline ll read()
{
ll x=,f=;char ch=getchar();
while(ch<''||ch>''){if(ch=='-')f=-;ch=getchar();}
while(ch>=''&&ch<=''){x=x*+ch-'';ch=getchar();}
return x*f;
}
//************************************************************************************** struct node
{
int x,y;
};
bool cmp(node a,node b)
{
return a.x>b.x;
}
node a[maxn];
int b[maxn];
int main()
{
int n=read();
for(int i=;i<=n;i++)
a[i].x=read(),a[i].y=i;
sort(a+,a++n,cmp);
int last=-inf;
int ans=;
for(int i=;i<=n;i++)
{
if(last!=a[i].x)
{
ans=i;
last=a[i].x;
}
b[a[i].y]=ans;
}
for(int i=;i<=n;i++)
cout<<b[i]<<" ";
}

Codeforces Round #307 (Div. 2) A. GukiZ and Contest 水题的更多相关文章

  1. 水题 Codeforces Round #307 (Div. 2) A. GukiZ and Contest

    题目传送门 /* 水题:开个结构体,rk记录排名,相同的值有相同的排名 */ #include <cstdio> #include <cstring> #include < ...

  2. Codeforces Round #357 (Div. 2) A. A Good Contest 水题

    A. A Good Contest 题目连接: http://www.codeforces.com/contest/681/problem/A Description Codeforces user' ...

  3. Codeforces Round #297 (Div. 2)A. Vitaliy and Pie 水题

    Codeforces Round #297 (Div. 2)A. Vitaliy and Pie Time Limit: 2 Sec  Memory Limit: 256 MBSubmit: xxx  ...

  4. Codeforces Round #290 (Div. 2) A. Fox And Snake 水题

    A. Fox And Snake 题目连接: http://codeforces.com/contest/510/problem/A Description Fox Ciel starts to le ...

  5. Codeforces Round #322 (Div. 2) A. Vasya the Hipster 水题

    A. Vasya the Hipster Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/581/p ...

  6. Codeforces Round #373 (Div. 2) B. Anatoly and Cockroaches 水题

    B. Anatoly and Cockroaches 题目连接: http://codeforces.com/contest/719/problem/B Description Anatoly liv ...

  7. Codeforces Round #368 (Div. 2) A. Brain's Photos 水题

    A. Brain's Photos 题目连接: http://www.codeforces.com/contest/707/problem/A Description Small, but very ...

  8. Codeforces Round #359 (Div. 2) A. Free Ice Cream 水题

    A. Free Ice Cream 题目连接: http://www.codeforces.com/contest/686/problem/A Description After their adve ...

  9. Codeforces Round #355 (Div. 2) A. Vanya and Fence 水题

    A. Vanya and Fence 题目连接: http://www.codeforces.com/contest/677/problem/A Description Vanya and his f ...

随机推荐

  1. delphi 怎么把image上的图片粘贴到剪切板上

    这个给你一个简单的代码,仅提供思路. uses Clipbrd; //引用单元 procedure TForm1.Button1Click(Sender: TObject); var Bmp: TBi ...

  2. CKEditor和IMCE构建drupal编辑器

    1. 安装并启用CKEditor和IMCE模块. 2. 配置CKEditor: 3. 配置用户的权限即可.最终效果图:

  3. SQLite数据库和JPA简单介绍

    SQLite数据库和JPA简单介绍 一.SQLite简单使用 SQLite是遵循ACID的关系数据库管理系统,它的处理速度很快,它的设计目标是嵌入式的,只需要几百K的内存就可以了. 1.下载SQLit ...

  4. Java核心 --- 注解

    Java核心——注解 注解是jdk5以后的新特性,Spring和Hibernate等框架提供了注解的配置方式使用, 本文参考了浪曦风中叶的注解讲解,主要讲解jdk内置注解的用法,注解的声明和定义,以及 ...

  5. navicat 或者workbench 无法连接127.0.0.1(61)的解决方法

    1.输入mysql -uroot 进入命令行模式, 2.输入"show variables like '%sock%';"查看sock文件所在位置 如: 3.配置客户端(以navi ...

  6. HTML5标签改变

    1.新的文档类型声明(DTD): HTML 5的DTD声明为: <!doctype html> <!DOCTYPE html >等也是正确的,因为HTML语法是不区分大小写的. ...

  7. windows平台下,快速删除所有.svn文件夹

    新建一个注册表文件名为:DELSVN.reg编辑其内容如下: Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SOFTWARE\Cla ...

  8. 第二百零一天 how can I坚持

    sql要学的东西还很多,很简单的一个sql都不会写,还得请教别人,哎. 八千代.铜钱草,小叶元宝,绿萝.还有我的鱼,还有罗娜. 今天试用了一下三星,系统优化就是不行啊,掉电太快,想搞个小米5,还想买个 ...

  9. Spark的优点

    Spark的一站式解决方案,非常之具有吸引力,毕竟啊,任何公司都想用统一的平台去处理遇到的问题,减少开发和维护的人力成本和部署平台的物力成本. 当然,Spark并没有以牺牲性能为代价.相反,在性能方面 ...

  10. c# 邮件发送代码分享

    /// <summary> /// 发送邮件方法 /// </summary> /// <param name="sendMail">发送人&l ...