Advertisement
Rofyda_Elghadban1

Untitled

Nov 2nd, 2023
849
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.76 KB | None | 0 0
  1.  #include <bits/stdc++.h>
  2.  #define ll long long
  3.  #define ull unsigned long long
  4.  #define pi 3.141592654
  5.  #define NUM 1e18
  6.  #define Mod  1'000'000'007
  7.  #define fixed(n) fixed<<setprecision(n)
  8.  #define cin(v) for(auto &i:v) cin >> i ;
  9.  #define cout(v) for(auto &i:v) cout << i  <<" ";
  10.  #define vowel(x) (x=='e'||x=='a'||x=='i'||x=='o'||x=='u')
  11.  #define small(x) (x>=97&&x<=122)
  12.  #define capital(x) (x>=65&&x<=90)
  13.  #define Tolower(s) transform(s.begin(),s.end(),s.begin(),::tolower);
  14.  #define Toupper(s) transform(s.begin(),s.end(),s.begin(),::toupper);
  15.  #define all(v) ((v).begin()), ((v).end())
  16.  #define allr(v) ((v).rbegin()), ((v).rend())
  17.  #define updmax(a,b) a=max(a,b)
  18.  #define updmin(a,b) a=min(a,b)
  19.  //#define ceil(a,b) ((a/b)+(a%b?1:0))
  20.  /* asc -> 1 2 3 ,des -> 3 2 1 */
  21.  /***********************************************************************************/
  22.  using namespace std;
  23.  void Rofyda_Elghadban(){
  24.   #ifndef ONLINE_JUDGE  
  25.     freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout);
  26.    #endif
  27.     ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
  28.  }
  29.  
  30.  void solve(){
  31.   int n,counter=0;
  32.   cin>>n;
  33.   vector<int>aa,bb,a1,b1;
  34.   while(n--){
  35.     int a,b;
  36.     cin>>a>>b;
  37.     aa.push_back(a);
  38.     bb.push_back(b);
  39.   }
  40.   map<int,int>mpa,mpb;
  41.   for(int i=0;i<aa.size();i++){
  42.     mpa[aa[i]]=i;
  43.     mpb[bb[i]]=i;
  44.   }
  45.   for(auto i:mpa){
  46.     a1.push_back(i.first);
  47.   }
  48.   for(auto i:mpb){
  49.     b1.push_back(i.first);
  50.   }
  51.   if(mpa[a1[aa.size()-1]]!=mpb[b1[bb.size()-1]]||mpa[a1[0]]!=mpb[b1[0]]){
  52.     cout<<"Happy Alex"<<"\n";
  53.   }else{
  54.     cout<<"Poor Alex"<<"\n";
  55.   }
  56.  }
  57.  
  58.  int main(){
  59.   Rofyda_Elghadban();
  60.   // int t;
  61.   // cin>>t;
  62.   // while(t--){
  63.   //   solve();
  64.   // }
  65.   solve();
  66.   return 0;
  67.  }
  68.  
  69.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement