Codeforces 456A - Laptops
题目链接:http://codeforces.com/problemset/problem/456/A
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 <string>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
using namespace std;
#define N 100010
struct com
{
int x,y;
}a[N];
bool cmp(com l,com m){
if(l.x==m.x) return l.y>m.y;
else return l.x<m.x;
}
int main()
{
int n;
while(cin>>n){
for(int i=;i<n;i++){
cin>>a[i].x>>a[i].y;
}
sort(a,a+n,cmp);
int flag=;
for(int i=;i<n;i++){
if(a[i].x>a[i-].x&&a[i].y<a[i-].y){
flag=;
}
if(flag) break;
}
if(flag) cout<<"Happy Alex"<<endl;
else cout<<"Poor Alex"<<endl;
}
return ;
}
Codeforces 456A - Laptops的更多相关文章
- CodeForces 456A
Laptops Time Limit:1000MS Memory Limit:262144KB 64bit IO Format:%I64d & %I64u Submit Sta ...
- 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 Round #260 (Div. 2)AB
http://codeforces.com/contest/456/problem/A A. Laptops time limit per test 1 second memory limit per ...
- CodeForces 164 B. Ancient Berland Hieroglyphs 单调队列
B. Ancient Berland Hieroglyphs 题目连接: http://codeforces.com/problemset/problem/164/B Descriptionww.co ...
- python爬虫学习(5) —— 扒一下codeforces题面
上一次我们拿学校的URP做了个小小的demo.... 其实我们还可以把每个学生的证件照爬下来做成一个证件照校花校草评比 另外也可以写一个物理实验自动选课... 但是出于多种原因,,还是绕开这些敏感话题 ...
- 【Codeforces 738D】Sea Battle(贪心)
http://codeforces.com/contest/738/problem/D Galya is playing one-dimensional Sea Battle on a 1 × n g ...
- 【Codeforces 738C】Road to Cinema
http://codeforces.com/contest/738/problem/C Vasya is currently at a car rental service, and he wants ...
- 【Codeforces 738A】Interview with Oleg
http://codeforces.com/contest/738/problem/A Polycarp has interviewed Oleg and has written the interv ...
随机推荐
- Ajax请求 一般处理程序参数传递的几种方式
//第一种Ajax请求 $.ajax({ type:"GET", //请求类型,有get,post等类型,和表单提交是一样的 url:"Result.aspx" ...
- 微信小程序tabbar设置样式在哪里改
微信小程序tabbar通俗点说就是底部导航,我们一般会配置相关的菜单,方便读者快速导航.tabbar是在项目根目录中的配置文件 app.json 中进行设置:如果小程序是一个多 tab 应用(客户端窗 ...
- RN animated组动画
代码: export default class AnimationGroupScene extends Component { constructor() { super() ) ) ) } com ...
- 用xtrabackup2.4备份mysql5.6.30一直显示log scanned up to
用xtrabackup2.4备份mysql5.6.30一直显示log scanned up to 一直处于log scanned up to,只能ctrl+c强制终止备份 没有大事务 停止xtraba ...
- Java基础知识(JAVA集合框架之List与Set)
List和Set概述数组必须存放同一种元素.StringBuffer必须转换成字符串才能使用,如果想拿出单独的一个元素几乎不可能.数据有很多使用对象存,对象有很多,使用集合存. 集合容器因为内部的数据 ...
- lambda 表达式拼接
类库: using System; using System.Collections.Generic; using System.Linq; using System.Linq.Expressions ...
- 使用github(一)
一.使用Github(目的.基本概念) 1.目的 借助github托管项目代码 2.基本概念 (1)仓库(Repository) 仓库即项目的意思,你想在github上开源一个项目,那就必须要新建一个 ...
- Xgboost调参总结
一.参数速查 参数分为三类: 通用参数:宏观函数控制. Booster参数:控制每一步的booster(tree/regression). 学习目标参数:控制训练目标的表现. 二.回归 from xg ...
- python regularexpress
这个正则表达式,我还真没有接触过,在python首次学习 //test.py 1 import re 2 3 print (re.match('www', 'www.myweb.com').span( ...
- Express web框架 upload file
哈哈,敢开源,还是要有两把刷子的啊 今天,看看node.js 的web框架 Express的实际应用 //demo1 upload file <html><head><t ...