Description

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.

Input

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.

Output

If Alex is correct, print "Happy Alex", otherwise print "Poor Alex" (without the quotes).

Examples
input
2
1 2
2 1
output
Happy Alex
题意:问你是价格高才质量高,还是价格低质量高
解法:排序,如果发现价格高但质量比之前的低,就输出Poor Alex,否则就是Happy Alex
#include<bits/stdc++.h>
using namespace std;
class P
{
public:
int n,m;
};
bool cmd(P x,P y)
{
return x.n<y.n;
}
int main()
{
P x[100005];
int n;
cin>>n;
for(int i=1;i<=n;i++)
{
cin>>x[i].m>>x[i].n;
}
sort(x+1,x+1+n,cmd);
for(int i=2;i<=n;i++)
{
if(x[i].m<x[i-1].m)
{
cout<<"Happy Alex"<<endl;
return 0;
}
}
cout<<"Poor Alex"<<endl;
return 0;
}

  

Codeforces Round #260 (Div. 2) A的更多相关文章

  1. DP Codeforces Round #260 (Div. 1) A. Boredom

    题目传送门 /* 题意:选择a[k]然后a[k]-1和a[k]+1的全部删除,得到点数a[k],问最大点数 DP:状态转移方程:dp[i] = max (dp[i-1], dp[i-2] + (ll) ...

  2. 递推DP Codeforces Round #260 (Div. 1) A. Boredom

    题目传送门 /* DP:从1到最大值,dp[i][1/0] 选或不选,递推更新最大值 */ #include <cstdio> #include <algorithm> #in ...

  3. Codeforces Round #260 (Div. 2)AB

    http://codeforces.com/contest/456/problem/A A. Laptops time limit per test 1 second memory limit per ...

  4. Codeforces Round #260 (Div. 1) D. Serega and Fun 分块

    D. Serega and Fun Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/455/pro ...

  5. Codeforces Round #260 (Div. 1) C. Civilization 并查集,直径

    C. Civilization Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/455/probl ...

  6. Codeforces Round #260 (Div. 1) A - Boredom DP

    A. Boredom Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/455/problem/A ...

  7. Codeforces Round #260 (Div. 1) A. Boredom (简单dp)

    题目链接:http://codeforces.com/problemset/problem/455/A 给你n个数,要是其中取一个大小为x的数,那x+1和x-1都不能取了,问你最后取完最大的和是多少. ...

  8. Codeforces Round #260 (Div. 1) 455 A. Boredom (DP)

    题目链接:http://codeforces.com/problemset/problem/455/A A. Boredom time limit per test 1 second memory l ...

  9. Codeforces Round #260 (Div. 2)

    A. Laptops 题目意思: 给定n台电脑,第i台电脑的价格是ai ,质量是bi ,问是否存在一台电脑价格比某台电脑价格底,但质量确比某台电脑的质量高,即是否存在ai < aj 且 bi & ...

  10. Codeforces Round #260 (Div. 2) C

    Description Alex doesn't like boredom. That's why whenever he gets bored, he comes up with games. On ...

随机推荐

  1. sdutoj 2154 Shopping

    http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblem&problemid=2154 Shopping Time Limit: ...

  2. android studio adb

    bogon:platform-tools alamps$ echo $HOME /Users/alamps bogon:platform-tools alamps$ echo $PATH /usr/l ...

  3. Cortex-R5

    TCM:Tightly Coupled Memory,连接到RAM等memory中,但是CPU读写速度很快. ECC:Error Checking and Correction PMU:Perform ...

  4. 创建DirectInput接口对象说明---(void **)&m_pDI

    读别人代码时遇到的,起初没明白过来这是怎么回事,后来忽然想明白了. if (FAILED(DirectInput8Create(appInstance, DIRECTINPUT_VERSION, II ...

  5. Openstack的nova-network的vlan模式扩展2

    接上一篇,上一篇我们使用的是nova-manage命令来创建的网络,这里就有一些知识需要了解 遇到的问题 控制节点的前面的BUG已经按官方解决BUG方式解决了,但是在开发dashboard,使用nov ...

  6. CentOS:安装桌面GNOME图形化界面

    u盘安装dvd版的CentOS7后,没有桌面,浏览器也是黑框版的:如果需要桌面的话,下面三条命令即可:但是安装桌面后,系统会没有之前纯净: 1 安装Gnome包: sudo yum groupinst ...

  7. xhr dojo load

    require(["dojo/_base/xhr"], function(xhr) { // Execute a HTTP GET request xhr.get({ // The ...

  8. 我的Windows naked apps

    0. 驱动精灵全能网卡版 1. Microsoft Office 2010/2013 2. IE 11 3. Filezilla Client & Server 4. Google Chrom ...

  9. init_MUTEX 与 sema_init 函数【转】

    转自:http://blog.chinaunix.net/uid-7332782-id-3211627.html 在编译Linux设备驱动程序学习(1)-字符设备驱动程序中scull.c程序时,报错: ...

  10. taglib指令

    taglib:用来引用标签库并设置标签库的前缀,(允许JSP页面使用用户自定义标签) 语法:<%@ taglib uri="tagLibraryURI" prefix=&qu ...