CF# 260 A. Laptops
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.
Please, check the guess of Alex. You are given descriptions of n laptops. Determine whether two described above laptops exist.
The first line contains an integer n (1 ≤ n ≤ 105)
— the number of laptops.
Next n lines contain two integers each, ai and bi (1 ≤ ai, bi ≤ n),
where ai is
the price of the i-th laptop, and bi is
the number that represents the quality of the i-th laptop (the larger the number is, the higher is the quality).
All ai are distinct.
All bi are distinct.
If Alex is correct, print "Happy Alex", otherwise print "Poor Alex"
(without the quotes).
2
1 2
2 1
Happy Alex
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<limits.h>
using namespace std;
const int maxn=1e5+10;
struct node{
int x,y;
}e[maxn];
int cmp(node l1,node l2)
{
return l1.x<l2.x;
}
int main()
{
int n;
while(~scanf("%d",&n))
{
for(int i=0;i<n;i++)
scanf("%d%d",&e[i].x,&e[i].y);
sort(e,e+n,cmp);
int flag=0;
for(int i=1;i<n;i++)
{
if(e[i].x>e[i-1].x&&e[i].y<e[i-1].y)
{
flag=1;
break;
}
}
if(flag)
cout<<"Happy Alex"<<endl;
else
cout<<"Poor Alex"<<endl;
}
return 0;
}
CF# 260 A. Laptops的更多相关文章
- CF456D A Lot of Games (字典树+DP)
D - A Lot of Games CF#260 Div2 D题 CF#260 Div1 B题 Codeforces Round #260 CF455B D. A Lot of Games time ...
- CF456B Fedya and Maths 找规律
http://codeforces.com/contest/456/problem/B CF#260 div2 B Fedya and Maths Codeforces Round #260 B. F ...
- CF456C Boredom (DP)
Boredom CF#260 div2 C. Boredom Codeforces Round #260 C. Boredom time limit per test 1 second memory ...
- Codeforces 260 A - A. Laptops
题目链接:http://codeforces.com/contest/456/problem/A 解题报告:有n种电脑,给出每台电脑的价格和质量,要你判断出有没有一种电脑的价格小于另一种电脑但质量却大 ...
- Codeforces Round #260 (Div. 2)A. Laptops
A. Laptops time limit per test 1 second memory limit per test 256 megabytes input standard input out ...
- [codeforces 260]B. Ancient Prophesy
[codeforces 260]B. Ancient Prophesy 试题描述 A recently found Ancient Prophesy is believed to contain th ...
- CF卡技术详解——笔记
知识太全面了,摘抄摘不完,还是粘过来加上注释和笔记吧. 重点以及断句用加粗,注释用红括号. 一.CF卡技术及规格 一.CF卡技术及规格 1.CF卡简史 随着数码产品的高速普及,近年来闪存卡也进入了高速 ...
- ORA-00494: enqueue [CF] held for too long (more than 900 seconds) by 'inst 1, osid 5166'
凌晨收到同事电话,反馈应用程序访问Oracle数据库时报错,当时现场现象确认: 1. 应用程序访问不了数据库,使用SQL Developer测试发现访问不了数据库.报ORA-12570 TNS:pac ...
- Codeforces Round #260 (Div. 2)
A. Laptops 题目意思: 给定n台电脑,第i台电脑的价格是ai ,质量是bi ,问是否存在一台电脑价格比某台电脑价格底,但质量确比某台电脑的质量高,即是否存在ai < aj 且 bi & ...
随机推荐
- CentOS 6下配置本地用户访问vsftpd并赋予写权限
一.安装并测试可用性 1.安装命令 yum install vsftpd 2.配置防火墙,加入一行 -A INPUT -p tcp -m tcp --dport 21 -j ACCEPT 在其它机测试 ...
- 从源码看Android中sqlite是怎么通过cursorwindow读DB的
更多内容在这里查看 https://ahangchen.gitbooks.io/windy-afternoon/content/ 执行query 执行SQLiteDatabase类中query系列函数 ...
- VMware ESXI4.1 常用命令
一. VMware ESX Command 1. # vmware –v (查看esx版本) 2. # esxcfg-info -a(查看显示ESX硬件,内核,存储,网络等信息) # esxcfg- ...
- J2SE知识点摘记(二十)
List 1.3.1 概述 前面我们讲述的Collection接口实际上并没有直接的实现类.而List是容器的一种,表示列表的意思.当我们不知道存储的数据有多少的情况,我们就可以使用Li ...
- gcc编译器对宽字符的识别
最早是使用VC++工具来学习C++,学的越多就越对VC挡住的我看不见的东西好奇,总想多接触一些开发环境,今日抽空摸索了一下CodeBlocks这个开源的IDE使用方法,配置的编译器是MinGW的gcc ...
- Xcode证书破解 iphone真机部署
Xcode证书破解 iphone真机部署 证书伪造: 先按照该教程的步骤添加证书.注意,原教程选择的是"系统"证书,这里我们用"登录"证书,切记. Xcode破 ...
- DataGuard failover dg role自动切换模式测试
1,在脚本中代入create db flash backup point for recover dg 2,测试前主备库状态(备库现角色验证,主库监听状态-->有意stop) 主要验证思路, 脚 ...
- Gallery平滑移动
看了些网上的方法弄了下平滑移动的效果,虽说最后是实现了,实现后发现也不是我想要的效果,对于我幸苦写过的代码先存放在这上面了 package com.layout; import android.con ...
- icon
<link rel="icon" href="favicon.ico" type="image/x-icon"> <lin ...
- Android开发学习之TypedArray类
在学习Android的开发中,学习Gallery视图显示图片的过程中,在设置图片适配器的时候,用到了此TypedArray类型,这次根据android SDK,一块把此类型弄清楚! android.c ...