codeforces-scrape

Codeforces scraped problems and editorials
git clone git://git.laack.co/codeforces-scrape.git
Log | Files | Refs | README

456A.md (1306B)


      1 Source: https://codeforces.com/problemset/problem/456/A
      2 
      3 A. Laptops
      4 
      5 time limit per test
      6 
      7 1 second
      8 
      9 memory limit per test
     10 
     11 256 megabytes
     12 
     13 input
     14 
     15 stdin
     16 
     17 output
     18 
     19 stdout
     20 
     21 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.
     22 
     23 Please, check the guess of Alex. You are given descriptions of *n* laptops. Determine whether two described above laptops exist.
     24 
     25 Input
     26 
     27 The first line contains an integer *n* (1 ≤ *n* ≤ 105) — the number of laptops.
     28 
     29 Next *n* lines contain two integers each, *a**i* and *b**i* (1 ≤ *a**i*, *b**i* ≤ *n*), where *a**i* is the price of the *i*-th laptop, and *b**i* is the number that represents the quality of the *i*-th laptop (the larger the number is, the higher is the quality).
     30 
     31 All *a**i* are distinct. All *b**i* are distinct.
     32 
     33 Output
     34 
     35 If Alex is correct, print "Happy Alex", otherwise print "Poor Alex" (without the quotes).
     36 
     37 Examples
     38 
     39 Input
     40 
     41 ```
     42 2  
     43 1 2  
     44 2 1
     45 ```
     46 
     47 Output
     48 
     49 ```
     50 Happy Alex
     51 ```