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. php post get 繁体、日文、韩文时 自动添加 反斜杠 问题

    做些二次开发项目,数据库.文件编码没法大规模的修改,比如二次开发一个日文系统,编码是JA16SJIS,$_POST或$_GET的信息中如果“申請”,得到的信息就会变成“申\請”,多出一个反斜杠! 先贴 ...

  2. 利用 Nginx 做反向代理解决微信小程序业务域名限制问题

    参考网站:(下述两个参考网站可以完美解决问题) https://www.jianshu.com/p/47eff6eeec25 https://www.cnblogs.com/kenwar/p/8288 ...

  3. Vue生命周期钩子详解【个人解读】

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  4. dfs.replication、dfs.replication.min/max及dfs.safemode.threshold.pct

    一.参数含义 dfs.replication:设置数据块应该被复制的份数: dfs.replication.min:所规定的数据块副本的最小份数: dfs.replication.max:所规定的数据 ...

  5. 自己用的opensuse源

    utsc_oss               http://mirrors.ustc.edu.cn/opensuse/distribution/13.1/repo/oss/utsc_non_oss  ...

  6. r.js 配置文件 example.build.js 不完整注释

    /* * This is an example build file that demonstrates how to use the build system for * require.js. * ...

  7. 九度oj 1003 A+B 2010年浙江大学计算机及软件工程研究生机试真题

    题目1003:A+B 时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:12812 解决:5345 题目描述: 给定两个整数A和B,其表示形式是:从个位开始,每三位数用逗号",&qu ...

  8. Shiro与Spring、Springmvc的整合

    1.在web.xml中配置Shiro的filter 在web系统中,shiro也通过filter进行拦截.filter拦截后将操作权交给spring中配置的filterChain(过虑链儿) shir ...

  9. Principal Component Analysis(PCA)

    Principal Component Analysis(PCA) 概念 去中心化(零均值化): 将输入的特征减去特征的均值, 相当于特征进行了平移, \[x_j - \bar x_j\] 归一化(标 ...

  10. telnet 命令使用方法详解

    参考自:这里 什么是telnet? 简单来说,可以把telnet当作一种通信协议.但对于入侵者来说,telnet只是一种远程登陆的工具.一旦入侵者与远程主机建立了telnet链接,入侵者便可以使用目标 ...