codedorces 260 div2 A题

水题,扫描一遍看是否出现价格低质量高的情况。
#include<cstdio>
#include<string>
#include<vector>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
struct Node{
    int a, b;
    Node(int a, int b){
        this->a = a;
        this->b = b;
    }
    bool operator < (const Node &A) const{
        if(a == A.a) return b <  A.b;
        return a < A.a;
    }
};
vector<Node>V;
int main(){
    int n, t1, t2;
    scanf("%d", &n);
    for(int i = 0;i < n;i ++){
        scanf("%d%d",&t1, &t2);
        V.push_back(Node(t1, t2));
    }
    sort(V.begin(), V.end());
    int flag = 0;
    for(int i = 1;i < n;i ++){
        if(V[i-1].b > V[i].b){
            flag = 1;
            break;
        }
    }
    if(!flag) printf("Poor Alex\n");
    else printf("Happy Alex\n");
}

posted on 2014-08-09 07:54  wangzhili  阅读(187)  评论(0编辑  收藏  举报