CF-807A

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.

题意:

对于给出的数字对,若前后不相等,则为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数组降序排列 
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 } 

 

转载于:https://www.cnblogs.com/Kiven5197/p/6825348.html

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/401006.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

UI代码练习-视图的层次关系

2019独角兽企业重金招聘Python工程师标准>>> // // AppDelegate.h // 视图的层次关系 // // Created by on 14-12-17. // Copyright (c) 2014年 apple. All rights reserved. //#import <UIKit/UIKit.h> #import <CoreData/CoreData.h>interface Ap…

arthas学习图文记录

&#x1f680; 优质资源分享 &#x1f680; 学习路线指引&#xff08;点击解锁&#xff09;知识定位人群定位&#x1f9e1; Python实战微信订餐小程序 &#x1f9e1;进阶级本课程是python flask微信小程序的完美结合&#xff0c;从项目搭建到腾讯云部署上线&#xff0c;打造一…

利用矩阵的n次方求图的连通性

设A&#xff08;n x n&#xff09;为一个图的邻接矩阵&#xff0c;则a(i,j)表示两个点之间是否连通&#xff08;1&#xff1a;连通&#xff0c;0&#xff1a;不连通&#xff09;。那么A的k次方中的每一个a&#xff08;i&#xff0c;j&#xff09;表示点i和j之间长度为k的路的条…

ormlite 多表联合查询

ormlite 多表联合查询 QueryBuilder shopBrandQueryBuilder shopBrandDao.queryBuilder(); QueryBuilder shopQueryBuilder shopDao.queryBuilder();Where shopBrandWhere shopBrandQueryBuilder.where(); shopBrandWhere .eq(ShopBrand.SHOP_NO, shopNo);Where shopWhere …

使用HBuilder新建项目

依次点击文件→新建→选择Web项目(按下CtrlN,W可以触发快速新建(MacOS请使用CommandN,然后左键点击Web项目)) 如上图&#xff0c;请在A处填写新建项目的名称&#xff0c;B处填写(或选择)项目保存路径(更改此路径HBuilder会记录&#xff0c;下次默认使用更改后的路径)&#xff0…

服务治理:几种开源限流算法库/应用软件介绍和使用

&#x1f680; 优质资源分享 &#x1f680; 学习路线指引&#xff08;点击解锁&#xff09;知识定位人群定位&#x1f9e1; Python实战微信订餐小程序 &#x1f9e1;进阶级本课程是python flask微信小程序的完美结合&#xff0c;从项目搭建到腾讯云部署上线&#xff0c;打造一…

iOS应用开发视频教程笔记(二)My First iOS App

这课主要是以一个计算器一个用为例子&#xff0c;教你怎么使用XCode&#xff0c;如何使用MVC设计模式创建应用。 (1)新建一个single view application模版的应用 打开xcode并点击“创建一个新xcode项目”&#xff0c;进入项目创建界面&#xff0c;这个界面让我们为应用选择一个…

xmemcached spring 配置文件

memcached spring 配置文件 <bean class"java.net.InetSocketAddress" name"server1"><constructor-arg><value>${memcached.server1.host}</value></constructor-arg><constructor-arg><value>${memcached.ser…

牛顿迭代法(Newton#39;s Method)

牛顿迭代法&#xff08;简称牛顿法&#xff09;由英国著名的数学家牛顿爵士最早提出。可是&#xff0c;这一方法在牛顿生前并未公开发表&#xff08;讨厌的数学家们还是鼓捣出来了&#xff09;牛顿法的作用是使用迭代的方法来求解函数方程的根。简单地说&#xff0c;牛顿法就是…

【深入理解计算机系统CSAPP】第六章 存储器层次结构

&#x1f680; 优质资源分享 &#x1f680; 学习路线指引&#xff08;点击解锁&#xff09;知识定位人群定位&#x1f9e1; Python实战微信订餐小程序 &#x1f9e1;进阶级本课程是python flask微信小程序的完美结合&#xff0c;从项目搭建到腾讯云部署上线&#xff0c;打造一…

【转】无刷新验证用户名可用性

在用户注册时&#xff0c;我们经常需要检查用户名是否存在&#xff0c;本文就是实现无刷新验证用户名 打开开发环境VS 2005,新建项目(或打开现有项目),新建一个Web窗体,命名为 Default.aspx 代码如下&#xff1a; View Code <% Page Language"C#" AutoEventWireu…

视图的创建

-- 创建数据库 create table emp( sid int(8) primary key, sname varchar(10), sex varchar(2), chu varchar(50), classno varchar(50) ); -- 表中的数据 insert into emp (sname,sex,chu,classno) values (张石瑞,男,1996-01-02,2600), (李佛,女,1998-05-15,3000), (王法无,…

压缩 js/css 的工具

最近检测服务器&#xff0c;发现js/css文件都没有压缩过&#xff0c;动手解决此问题先。 本次压缩采用 yui compress (2.4.8) 压缩脚本&#xff1a; #!/bin/sh echo "###########################" echo "---------------------------" echo "begin t…

Python数据分析--Numpy常用函数介绍(2)

&#x1f680; 优质资源分享 &#x1f680; 学习路线指引&#xff08;点击解锁&#xff09;知识定位人群定位&#x1f9e1; Python实战微信订餐小程序 &#x1f9e1;进阶级本课程是python flask微信小程序的完美结合&#xff0c;从项目搭建到腾讯云部署上线&#xff0c;打造一…

bzoj3224: Tyvj 1728 普通平衡树(打个splay暖暖手)

&#xff08;其实今天好热啊&#xff1f; 题目大意&#xff1a;插入&#xff0c;删除&#xff0c;k小&#xff0c;前驱后继&#xff0c;数的排名。 splay和treap裸题...过几天补个treap的 splay: #include<iostream> #include<cstdlib> #include<cstring> #i…

手机相机自动识别语音提示

技术背景&#xff1a; 时下流行的手机拍照功能越来越多&#xff0c;在众多的手机拍照过程中&#xff0c;我们只在于手机拍照的效果和风景是否美好&#xff0c;甚至拿着手机自我狂拍&#xff0c;留下美好的记忆和回忆。 有时候根据手机相机的已有技术功能随便一设置就能拍到理想…

c# Invoke和BeginInvoke 区别

转自http://www.cnblogs.com/c2303191/articles/826571.html Control的Invoke和BeginInvoke是相对于支线线程&#xff08;因为一般在支线线程中调用&#xff0c;用来更新主线程ui&#xff09;Invoke立即插入主线程中执行&#xff0c;而BeginInvoke 要等主线程结束才执行 近日&a…

04 Springboot 格式化LocalDateTime

&#x1f680; 优质资源分享 &#x1f680; 学习路线指引&#xff08;点击解锁&#xff09;知识定位人群定位&#x1f9e1; Python实战微信订餐小程序 &#x1f9e1;进阶级本课程是python flask微信小程序的完美结合&#xff0c;从项目搭建到腾讯云部署上线&#xff0c;打造一…

DNN使用非80端口和总是跳转到http://localhost问题的解决

2019独角兽企业重金招聘Python工程师标准>>> 我试图在一台服务器上安装一个DNN网站时&#xff0c;遇到了一些问题。问题一&#xff1a;遇到的第一个问题就是网站总是自动导向到localhost。不管我怎么试&#xff0c;只要我输入http://domain.com/dnn&#xff0c;总是…

解决解决鼠标右键被锁定

现象&#xff1a;我的电脑不知道为什么鼠标右键被锁定了&#xff0c;用不了。请问如何解决&#xff1f;可能是有人在你的注册表中做了手脚&#xff0c;锁定了右键菜单。打开注册表编辑器&#xff0c;选择以下子键&#xff1a;“HKEY_CURRENT_USER\Software\Microsoft\Windows\C…