-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path456A.cpp
More file actions
49 lines (37 loc) · 721 Bytes
/
Copy path456A.cpp
File metadata and controls
49 lines (37 loc) · 721 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include <iostream>
#include<utility>
#include<algorithm>
#include<vector>
#define mp make_pair
#define pb push_back
using namespace std ;
int main(){
int n, t1, t2;
cin >> n ;
vector<pair<int, int> > v; ;
for (int i = 0; i < n; ++i){
cin >> t1 >> t2 ;
v.pb(mp(t1, t2));
}
sort(v.begin(), v.end());
vector<pair<int, int> >::iterator it = v.begin();
int hs = INT_MIN ;
int hsp = INT_MAX ;
bool found = false ;
for(; it != v.end() ; it++){
if (it->second > hs){
hs = it->second ;
hsp = it->first ;
}
if (hs > it->second && hsp < it->first){
found = true ;
break ;
}
}
if (found) {
cout << "Happy Alex" << endl ;
} else {
cout << "Poor Alex" << endl ;
}
return 0;
}