CF# 260 A. Laptops
One day Dima and Alex had an argument about the price and quality of laptops. Dima thinks that the more expensive a laptop is, the better it is. Alex disagrees. Alex thinks that there are two laptops, such that the price of the first laptop is less (strictly
smaller) than the price of the second laptop but the quality of the first laptop is higher (strictly greater) than the quality of the second laptop.
Please, check the guess of Alex. You are given descriptions of n laptops. Determine whether two described above laptops exist.
The first line contains an integer n (1 ≤ n ≤ 105)
— the number of laptops.
Next n lines contain two integers each, ai and bi (1 ≤ ai, bi ≤ n),
where ai is
the price of the i-th laptop, and bi is
the number that represents the quality of the i-th laptop (the larger the number is, the higher is the quality).
All ai are distinct.
All bi are distinct.
If Alex is correct, print "Happy Alex", otherwise print "Poor Alex"
(without the quotes).
2
1 2
2 1
Happy Alex
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<limits.h>
using namespace std;
const int maxn=1e5+10;
struct node{
int x,y;
}e[maxn];
int cmp(node l1,node l2)
{
return l1.x<l2.x;
}
int main()
{
int n;
while(~scanf("%d",&n))
{
for(int i=0;i<n;i++)
scanf("%d%d",&e[i].x,&e[i].y);
sort(e,e+n,cmp);
int flag=0;
for(int i=1;i<n;i++)
{
if(e[i].x>e[i-1].x&&e[i].y<e[i-1].y)
{
flag=1;
break;
}
}
if(flag)
cout<<"Happy Alex"<<endl;
else
cout<<"Poor Alex"<<endl;
}
return 0;
}
CF# 260 A. Laptops的更多相关文章
- CF456D A Lot of Games (字典树+DP)
D - A Lot of Games CF#260 Div2 D题 CF#260 Div1 B题 Codeforces Round #260 CF455B D. A Lot of Games time ...
- CF456B Fedya and Maths 找规律
http://codeforces.com/contest/456/problem/B CF#260 div2 B Fedya and Maths Codeforces Round #260 B. F ...
- CF456C Boredom (DP)
Boredom CF#260 div2 C. Boredom Codeforces Round #260 C. Boredom time limit per test 1 second memory ...
- Codeforces 260 A - A. Laptops
题目链接:http://codeforces.com/contest/456/problem/A 解题报告:有n种电脑,给出每台电脑的价格和质量,要你判断出有没有一种电脑的价格小于另一种电脑但质量却大 ...
- Codeforces Round #260 (Div. 2)A. Laptops
A. Laptops time limit per test 1 second memory limit per test 256 megabytes input standard input out ...
- [codeforces 260]B. Ancient Prophesy
[codeforces 260]B. Ancient Prophesy 试题描述 A recently found Ancient Prophesy is believed to contain th ...
- CF卡技术详解——笔记
知识太全面了,摘抄摘不完,还是粘过来加上注释和笔记吧. 重点以及断句用加粗,注释用红括号. 一.CF卡技术及规格 一.CF卡技术及规格 1.CF卡简史 随着数码产品的高速普及,近年来闪存卡也进入了高速 ...
- ORA-00494: enqueue [CF] held for too long (more than 900 seconds) by 'inst 1, osid 5166'
凌晨收到同事电话,反馈应用程序访问Oracle数据库时报错,当时现场现象确认: 1. 应用程序访问不了数据库,使用SQL Developer测试发现访问不了数据库.报ORA-12570 TNS:pac ...
- Codeforces Round #260 (Div. 2)
A. Laptops 题目意思: 给定n台电脑,第i台电脑的价格是ai ,质量是bi ,问是否存在一台电脑价格比某台电脑价格底,但质量确比某台电脑的质量高,即是否存在ai < aj 且 bi & ...
随机推荐
- Linux文件系统与结构
一.Linux文件系统结构 /bin 二进制的缩写,用来放置可执行的二进制程序,基本命令 /boot 用来存放启动文件,kernel 和boot配置文件 /dev 用来放置设备文件 /dev/cons ...
- Microsoft Office 2010 Pro VOL简体中文正式版
网友们期待的Microsoft Office Professional Plus 2010 VOL简体中文正式版.所谓的“VOL”,即是Volume Licensing for Organizatio ...
- git配置别名
配置别名 有没有经常敲错命令?比如git status?status这个单词真心不好记. 如果敲git st就表示git status那就简单多了,当然这种偷懒的办法我们是极力赞成的. 我们只需要 ...
- [虚拟化/云][全栈demo] 为qemu增加一个PCI的watchdog外设(四)
通过前面的操作,我们已经可以创建一个带有我们自己的PCI的watchdog外设qemu 虚拟机了. 目的: 1. 了解我们的外设情况. 2. 为在guest中开发我们自己的linux PCI驱动程序做 ...
- XML限制、初步WEB服务
DTD <!DOCTYPE 根元素 [ <!ELEMENT 元素 (a,b,c)>//必须按照根元素包含abc顺序排列 <!ATTLIST 属性 > ]> 引用方式 ...
- C++中顶层const和底层const
1. 顶层 const 与底层 const 概念 指针本身是一个对象,由于,指针实际相应着内存单元的一段存储空间,然而,指针所指向的也是一个数据对象,因此,指针是一个常量与指针所指向的是一个常量是两个 ...
- C# 轮循回调
class Program { static void Main(string[] args) { Func<int> func = new Func<int>(GetInt) ...
- Heritrix个性化设置抓取目标
本文是Heritrix的使用的高级篇,针对对Heritrix已经能够运行的码农朋友们! 我们在抓取网页的时候,网页的链接中往往会包含有js.css.图片.视频等文件,第一次执行抓取任务的时候,许多农民 ...
- Android屏幕适配与切图_汇总
首先和最后,还是先看好官方文档:http://developer.android.com/guide/practices/screens_support.html 对应的翻译blog有牛人做了:And ...
- R与数据分析旧笔记(⑦)回归诊断
回归诊断 回归诊断 1.样本是否符合正态分布假设? 2.是否存在离群值导致模型发生较大误差? 3.线性模型是否合理? 4.误差是否满足独立性.等方差.正态分布等假设条件? 5.是否存在多重共线性 正态 ...