Hustlingbeast_Anish

Codeforces Laptops

Feb 5th, 2022
26
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3.  
  4. bool sortbysec(const pair<int,int> &a, const pair<int,int> &b)
  5. {
  6. return (a.second>b.second);
  7. }
  8.  
  9. int main(){
  10. ios_base::sync_with_stdio(false);
  11. cin.tie(NULL);
  12.  
  13. int n;
  14. cin>>n;
  15. vector< pair<int,int> > vec;
  16.  
  17. while(n--)
  18. {
  19. int t,h;
  20. cin>>t>>h;
  21. vec.push_back(make_pair(t,h));
  22. }
  23. int ct=0;
  24. sort(vec.begin(),vec.end());
  25.  
  26. for(int i=0;i<vec.size()-1;i++){
  27.  
  28. if(vec[i].first<vec[i+1].first && vec[i].second> vec[i+1].second ){
  29. cout<<"Happy Alex"<<endl;
  30. ct=1;
  31. break;
  32. }
  33.  
  34. else if(i!=vec.size()-1){
  35. continue;
  36. }
  37.  
  38. }
  39. if(ct==0){
  40. cout<<"Poor Alex"<<endl;
  41. }
  42.  
  43.  
  44.  
  45. return 0;
  46. }
Advertisement
Add Comment
Please, Sign In to add comment