日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

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

發(fā)布時(shí)間:2023/11/29 编程问答 32 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Codeforces Round #307 (Div. 2) A. GukiZ and Contest 水题 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

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個(gè)學(xué)生排名

題解:

排個(gè)序,擼一遍就好了

代碼:

?

#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=0,f=1;char ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}while(ch>='0'&&ch<='9'){x=x*10+ch-'0';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=1;i<=n;i++)a[i].x=read(),a[i].y=i;sort(a+1,a+1+n,cmp);int last=-inf;int ans=0;for(int i=1;i<=n;i++){if(last!=a[i].x){ans=i;last=a[i].x;}b[a[i].y]=ans;}for(int i=1;i<=n;i++)cout<<b[i]<<" "; }

?

總結(jié)

以上是生活随笔為你收集整理的Codeforces Round #307 (Div. 2) A. GukiZ and Contest 水题的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。