A. Is it rated?
time limit per test 

2 seconds

memory limit per test 

256 megabytes

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".

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.

题目大意: 首先输入一个n表示参赛人数,然后给出n个人参赛前的分数和参赛后

      的分数,要求判断比赛完之后是否rate;

解题思路:首先判断赛前和赛后的分数是否相同,不同的话一定rate,

     否则判断是否按降序排列,是maybe否unrate。

AC代码:

 #include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#include <algorithm> using namespace std; struct Rating
{
int s;
int e;
}p[]; int main ()
{
int n,i;
int sum,s,j,flag;
while (~scanf("%d",&n))
{
flag = ;
for (i = ; i < n; i ++)
scanf("%d %d",&p[i].s,&p[i].e);
for (i = ; i < n; i ++) // 首先判断分数是否有变化
if (p[i].s != p[i].e)
{
flag = ; break;
}
if (flag)
{
printf("rated\n"); continue;
}
j = s = ;
for (i = ; i < n; i ++) // 然后判断是否是降序
{
if (p[i].s <= p[i-].s)
j ++;
}
if (j == n)
printf("maybe\n");
else
printf("unrated\n");
}
return ;
}

Codeforces Round #412 A Is it rated ?的更多相关文章

  1. Codeforces Round #412 (rated, Div. 2, base on VK Cup 2017 Round 3)(A.B.C,3道暴力题,C可二分求解)

    A. Is it rated? time limit per test:2 seconds memory limit per test:256 megabytes input:standard inp ...

  2. Codeforces Round #412 (rated, Div. 2, base on VK Cup 2017 Round 3) A B C D 水 模拟 二分 贪心

    A. Is it rated? time limit per test 2 seconds memory limit per test 256 megabytes input standard inp ...

  3. Codeforces Round #412 (rated, Div. 2, base on VK Cup 2017 Round 3) D - Dynamic Problem Scoring

    地址:http://codeforces.com/contest/807/problem/D 题目: D. Dynamic Problem Scoring time limit per test 2 ...

  4. Codeforces Round#412 Div.2

    A. Is it rated? 题面 Is it rated? Here it is. The Ultimate Question of Competitive Programming, Codefo ...

  5. Codeforces Round #412 Div. 2 第一场翻水水

    大半夜呆在机房做题,我只感觉智商严重下降,今天我脑子可能不太正常 A. Is it rated? time limit per test 2 seconds memory limit per test ...

  6. Codeforces Round #412 Div. 2 补题 D. Dynamic Problem Scoring

    D. Dynamic Problem Scoring time limit per test 2 seconds memory limit per test 256 megabytes input s ...

  7. Codeforces Round #412 (rated, Div. 2, base on VK Cup 2017 Round 3) A Is it rated?

    地址:http://codeforces.com/contest/807/problem/C 题目: C. Success Rate time limit per test 2 seconds mem ...

  8. Codeforces Round #412 (rated, Div. 2, base on VK Cup 2017 Round 3) E. Prairie Partition 二分+贪心

    E. Prairie Partition It can be shown that any positive integer x can be uniquely represented as x =  ...

  9. Codeforces Round #412 B. T-Shirt Hunt

    B. T-Shirt Hunt time limit per test 2 seconds memory limit per test 256 megabytes input standard inp ...

随机推荐

  1. using声明和using指示

    using声明(using declaration) using namespacename::namespacemember; using声明一次只引入命名空间的一个成员.从效果上看就好像using ...

  2. leetcode 191:统计1的个数;5 最长回文串;54,59 蛇形矩阵

    class Solution { public: int hammingWeight(uint32_t n) { ; //统计次数 ){ n &= (n-); //每次消掉一个1 k++; / ...

  3. HTML 标记大全参考手册

    1.文件结构 文件类型 <HTML></HTML> (放在文档的开头与结尾) 文件主题 <TITLE></TITLE> (必须放在「文头」区块内) 文头 ...

  4. Linux I2C驱动程序设计

    1. Linux I2C子系统架构 (1)I2C核心(I2C-Core):I2C 总线和I2C 设备驱动的中间枢纽,它提供了I2C 总线驱动和设备驱动的注册.注销方法等 (2)I2C控制器驱动(ada ...

  5. 关于CAS

    CAS就是Compare And Swap. CAS操作是在每一次做修改操作时,并不加锁,而是在修改时比较旧值是否有变化,如果旧值不变就执行修改,如果旧值有变,则修改失败. 使用sql表示就是 upd ...

  6. Centos 7搭建Gitlab服务器(一),搭配文章(二)一起使用,效果更好

    一. 安装并配置必要的依赖关系在CentOS系统上安装所需的依赖:ssh,防火墙,postfix(用于邮件通知) ,wget,以下这些命令也会打开系统防火墙中的HTTP和SSH端口访问. 1.安装ss ...

  7. Python Requests IP直连

    import re import requests from urllib3.util import connection _orig_create_connection = connection.c ...

  8. 2019年UX设计新趋势

    UX设计总是在不断变化中.最近短短两年的时间里,我们已经看到,很多地方都大规模采用颠覆性技术,比如语音用户界面,混合现实和智能家居设备.设计这些体验的实际过程可能保持不变,但新技术的出现引发了新的行为 ...

  9. Mysql+innodb数据存储逻辑

    Mysql+innodb数据存储逻辑. 表空间由段,区,页组成 ibdata1:共享表空间.即所有的数据都存放在这个表空间内.如果用户启用了innodb_file_per_table,则每张表内的数据 ...

  10. c# 如何得到一个字符的ASCII码

    '; int b = (int)a; 就这么简单..