题目描述:
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
题目大意:
首先注意一个大前提:1 ≤ ai, bi ≤ n ,这里只要满足低消费高回报就可以输出“Happy Alex”,又因为ai , bi 范围的限制,ai=bi是消费与回报相等的情况,所以只要输入的数据中有一行ai不等于bi便可以输出“Happy Alex”
代码:
#include <cstdio>
#include <iostream>
#include <cstring>
#include <algorithm>
#define LL long long
using namespace std;
const int maxn=500000;
int main()
{
int n,t,k;
int a,b;
while(scanf("%d",&n)!=EOF)
{
k=0;
for(int i=0;i<n;i++)
{
scanf("%d%d",&a,&b);
if(a!=b)k=1;
}
if(k)
cout<<"Happy Alex"<<endl;
else cout<<"Poor Alex"<<endl;
}
return 0;
}
//另,不太理解为什么把a,b换为a[],b[]不对