Codeforces Round #412 A Is it rated ?
2 seconds
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.
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.
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".
6
3060 3060
2194 2194
2876 2903
2624 2624
3007 2991
2884 2884
rated
4
1500 1500
1300 1300
1200 1200
1400 1400
unrated
5
3123 3123
2777 2777
2246 2246
2246 2246
1699 1699
maybe
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 ?的更多相关文章
- 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 ...
- 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 ...
- 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 ...
- Codeforces Round#412 Div.2
A. Is it rated? 题面 Is it rated? Here it is. The Ultimate Question of Competitive Programming, Codefo ...
- Codeforces Round #412 Div. 2 第一场翻水水
大半夜呆在机房做题,我只感觉智商严重下降,今天我脑子可能不太正常 A. Is it rated? time limit per test 2 seconds memory limit per test ...
- 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 ...
- 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 ...
- 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 = ...
- 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 ...
随机推荐
- Java学习笔记01
1.原型设计: 将页面的模块.元素.人机交互的形式,利用线框描述的方法,将产品脱离皮肤状态下更加具体跟生动的进行表达. 2.下面的是使用PowerDesigner进行设计的持久层的层次结构图: 虚线三 ...
- js 下不同浏览器,new Date转换结果时差
项目中在android上使用XWalkView作为浏览器,发现在解析时间的时候解析结果和实际结果有时差. android联机调试的截图如下: PC本机调试截图如下: 从android联机调试的截图看, ...
- Windbg双机调试环境配置(Windows7/Windows XP+VirtualBox/VMware+WDK7600)
简介:Windbg双机调试内核.驱动 下载软件: 下载Windbg(GRMWDK_EN_7600_1.ISO) 下载VirtualBox 5.2/VMware 12 一.安装WDK,这里要提一点的是D ...
- helloweblogic 官方qq群欢迎加入!
点击加入helloweblogic 官方qq群,大家一起进行中间件技术交流,问题交流,互相帮忙互相学习. 我的网易博客地址:http://fm928.blog.163.com 收到网易博客的邮件,以后 ...
- 采用轮询的方式检测串口输入&&采用中断的方式检测串口输入的区别!
区别1:中断USART1_IRQHandler()不放进main(主函数)里,而轮询检测rcv()需要: 但是需要在主函数里对中断NVIC()进行初始化,因为所有程序都是从主函数开始一步一步执行,想要 ...
- Linux下配置nginx,负载IIS的页面
最近研究了下Linux下的nginx结果贴一下: 反向代理概念: 一般访问流程:a=>b,a访问b服务器, 加n来做反向代理流程:a=>n=>b 负载均衡概率:a访问B站点,B站点有 ...
- V1-bug Alpha阶段项目展示
V1-bug Alpha阶段项目展示 团队成员简介 Name Summary Sefie wxmwy V1-bug制造公司资深工程师精通各种抱大腿方式团队吉祥物 182 面面俱到流派一丝不苟 Powe ...
- C#的datatable使用
// 构造datatable DataTable dt = new DataTable("test_table"); dt.Columns.AddRange(new DataCol ...
- (转)CentOS分区操作详解
CentOS分区操作详解 原文:http://blog.csdn.net/yonggeit/article/details/77924393 磁盘分区 分区格式的两种选择:MBR和GPT 分区命令: ...
- spark跑YARN模式或Client模式提交任务不成功(application state: ACCEPTED)
不多说,直接上干货! 问题详情 电脑8G,目前搭建3节点的spark集群,采用YARN模式. master分配2G,slave1分配1G,slave2分配1G.(在安装虚拟机时) export SPA ...