Codeforces Round #260 (Div. 2) A. Laptops
#include<bits/stdc++.h>
//#include<cstdio>
//#include<iostream>
//#include<algorithm>
//#include<vector>
//#include<cstring>
//#include<cmath>
//#include<map>
using namespace std;
#define fast ios_base::sync_with_stdio(false)
#define bfast cin.tie(0)
#define outs(x) cout << x << " "
#define outn(x) cout << x << "\n"
#define sf scanf
#define pf printf
#define high 100010
typedef long long LL;
typedef vector<int>vii;
typedef vector<LL>vll;
struct my
{
int price, quality;
};
my ar[high];
bool cmp(my a, my b)
{
return a.price < b.price;
}
int main()
{
fast;
int n , a , b , i;
while(cin >> n)
{
bool happy=false;
for(i=0; i<n; i++)
{
cin >> ar[i].price >> ar[i].quality;
}
sort(ar, ar+n , cmp);
for(i=0; i<n-1; i++)
{
if(ar[i].price < ar[i+1].price and ar[i].quality > ar[i+1].quality)
{
happy = true;
break;
}
}
if(happy) outn("Happy Alex");
else outn("Poor Alex");
}
return 0;
}
//#include<cstdio>
//#include<iostream>
//#include<algorithm>
//#include<vector>
//#include<cstring>
//#include<cmath>
//#include<map>
using namespace std;
#define fast ios_base::sync_with_stdio(false)
#define bfast cin.tie(0)
#define outs(x) cout << x << " "
#define outn(x) cout << x << "\n"
#define sf scanf
#define pf printf
#define high 100010
typedef long long LL;
typedef vector<int>vii;
typedef vector<LL>vll;
struct my
{
int price, quality;
};
my ar[high];
bool cmp(my a, my b)
{
return a.price < b.price;
}
int main()
{
fast;
int n , a , b , i;
while(cin >> n)
{
bool happy=false;
for(i=0; i<n; i++)
{
cin >> ar[i].price >> ar[i].quality;
}
sort(ar, ar+n , cmp);
for(i=0; i<n-1; i++)
{
if(ar[i].price < ar[i+1].price and ar[i].quality > ar[i+1].quality)
{
happy = true;
break;
}
}
if(happy) outn("Happy Alex");
else outn("Poor Alex");
}
return 0;
}
Comments
Post a Comment