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. 第二个UI脚本--Python+selenium之unittest+HTMLtestRunner及python的继承

    前面有一篇对于常见元素的识别和操作的python自动化脚本,这一篇就接着聊下python的类继承,已经它的第三款unittest框架,和报告收集包HTMLtestRunner的应用. 还是直接上代码吧 ...

  2. Java 分割文件 注意事项

    public static void main(String args[]) throws Exception { if (args.length < 1) { System.exit(0); ...

  3. Intent相关

    Intent是什么? 翻译为:意图,目的(名词) 其实根本没必要管它是什么,看看它能做什么就好了. 不过后来我知道了,它就是个机制----通信机制-----android的许多组件间的交流要依赖它. ...

  4. C++11 之 &quot; = delete &quot;

    1  缺省函数 设计一个类,没有成员函数 (member function),只有成员数据 (member data) class DataOnly { private: std::string st ...

  5. BITED-Windows8应用开发学习札记之一:Win8应用开发入门

    基于WinRT的Metro应用是我对Windows8的第一印象,简洁方块配以简单色调真的有沁人心脾的美感. 非常幸运,BITED在这个暑假的这个小学期里有幸学习到一门课程:软件工程基础实践,老师邀请了 ...

  6. MySql数据备份与恢复小结

    方法1 备份 .sql" FROM 表名; 恢复 .sql" INTO TABLE 表名; 补充几个设置 1. FIELDS TERMINATED BY ',' #字段间隔符2. ...

  7. ubuntu14.04修复启动项

    自从安装了ubuntu14.04系统后(win7+ubuntu双系统),一直使用grub来引导win7和ubuntu,很长一段时间都使用的很好.突然前两天win7进不去了,无奈之下就用pe修复了win ...

  8. HDU-3401 Trade 单调队列优化DP

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3401 DP方程容易想出来,f[i][j]表示第i天拥有j个股票的最优解,则: 1.不买不卖,f[i][ ...

  9. Nagle算法,tcp小包组合(延迟)发送的算法

    在j2ee中可能会引起业务的延迟,java自行决定是否需要使用 Socket.TCP_NODELAY 选项来禁用 nagle 策略算法.c语言的语法是: setsockopt( sock, IPPRO ...

  10. 全文索引之nutch与hadoop(转)

    原文:http://blog.csdn.net/chaofanwei/article/details/39476535 全文索引-lucene,solr,nutch,hadoop之lucene 全文索 ...