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

歡迎訪問 生活随笔!

生活随笔

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

编程问答

CF-807A

發(fā)布時間:2023/11/29 编程问答 24 豆豆
生活随笔 收集整理的這篇文章主要介紹了 CF-807A 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
A. Is it rated? time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output

Is it rated?

Here it is. The Ultimate Question of Competitive Programming, Codeforces, and Everything. And you are here to answer it.

Another Codeforces round has been conducted. No two participants have the same number of points. For each participant, from the top to the bottom of the standings, their rating before and after the round is known.

It's known that if at least one participant's rating has changed, then the round was rated for sure.

It's also known that if the round was rated and a participant with lower rating took a better place in the standings than a participant with higher rating, then at least one round participant's rating has changed.

In this problem, you should not make any other assumptions about the rating system.

Determine if the current round is rated, unrated, or it's impossible to determine whether it is rated of not.

Input

The first line contains a single integer?n?(2?≤?n?≤?1000)?— the number of round participants.

Each of the next?n?lines contains two integers?ai?and?bi?(1?≤?ai,?bi?≤?4126)?— the rating of the?i-th participant before and after the round, respectively. The participants are listed in order from the top to the bottom of the standings.

Output

If the round is rated for sure, print "rated". If the round is unrated for sure, print "unrated". If it's impossible to determine whether the round is rated or not, print "maybe".

Examples input 6
3060 3060
2194 2194
2876 2903
2624 2624
3007 2991
2884 2884 output rated input 4
1500 1500
1300 1300
1200 1200
1400 1400 output unrated input 5
3123 3123
2777 2777
2246 2246
2246 2246
1699 1699 output maybe Note

In the first example, the ratings of the participants in the third and fifth places have changed, therefore, the round was rated.

In the second example, no one's rating has changed, but the participant in the second place has lower rating than the participant in the fourth place. Therefore, if the round was rated, someone's rating would've changed for sure.

In the third example, no one's rating has changed, and the participants took places in non-increasing order of their rating. Therefore, it's impossible to determine whether the round is rated or not.

題意:

對于給出的數(shù)字對,若前后不相等,則為rated,若相等且按降序排列則為maybe,否則為unrated。

?

附AC代碼:

1 #include<bits/stdc++.h> 2 using namespace std; 3 4 int a[1010],c[1010]; 5 6 int main(){ 7 int n,b,flag=0; 8 cin>>n; 9 for(int i=0;i<n;i++){ 10 cin>>a[i]>>b; 11 if(a[i]!=b) 12 flag=1; 13 c[i]=a[i]; 14 } 15 if(flag){ 16 cout<<"rated"<<endl; 17 return 0; 18 } 19 flag=0; 20 sort(c,c+n,greater<int>());//對C數(shù)組降序排列 21 for(int i=0;i<n;i++){ 22 //cout<<a[i]<<" "<<c[i]<<endl; 23 if(a[i]!=c[i]){ 24 flag=1; 25 break; 26 } 27 } 28 if(flag){ 29 cout<<"unrated"<<endl; 30 return 0; 31 } 32 cout<<"maybe"<<endl; 33 return 0; 34 }

?

轉(zhuǎn)載于:https://www.cnblogs.com/Kiven5197/p/6825348.html

總結(jié)

以上是生活随笔為你收集整理的CF-807A的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

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