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 在其它机测试 ...
- jsp 配置MySQL服务器 以及数据的插入和读取
不多说,直接上代码.百度上面也是一大堆,大家多问百度就行. 在利用JDBC访问数据库过程中,主要涉及三种资源:对数据库的连接的连接对象Connection,SQL语句对象 Statement,访问结果 ...
- KETTLE使用入门
一.准备文件 1.安装java虚拟机 2.安装kettle安装文件 二.使用步骤 1.点击Spoon.bat,启动kettle,弹出DOS窗口如下: 2.进入主界面 3.新建资源库
- fcntl记录锁
#include<fcntl.h> int fcntl(fd,F_GETLK/F_SETLK/F_SETLKW,struct flock *flockptr); F_GETLK:测试flo ...
- 【Chromium中文文档】进程模型
进程模型 转载请注明出处:https://ahangchen.gitbooks.io/chromium_doc_zh/content/zh//General_Architecture/Process_ ...
- 一个简单的RTTI实现
RTTI是"Runtime Type Information"的缩写,意思是:运行时类型信息.它提供了运行时确定对象类型的方法. 最近在写的一些东西,不想使用MFC之类的框架,但是 ...
- git创建标签
创建标签 在Git中打标签非常简单,首先,切换到需要打标签的分支上: $ git branch * dev master $ git checkout master Switched to branc ...
- 奇怪的问题:android:focusable和android:clickable造成ListView的点击不了
今天花了我很长时间,才解决一个很奇怪的问题,就是在ListView的点击反应不了的问题…… 在ListView中,如果其中一个元素设置为android:focusable="true&quo ...
- ORACLE case when then
Oracle CASE WHEN 用法介绍 1. CASE WHEN 表达式有两种形式 --简单Case函数 CASE sex WHEN '1' THEN '男' WHEN '2' THEN '女' ...
- C++_知识点_namespace
#include <iostream> #include <string> using namespace std; void name() { cout << & ...