cf B. Anton and Lines (STL)
来源:互联网 发布:vb net入门教程pdf 编辑:程序博客网 时间:2024/04/29 10:45
#include<bits/stdc++.h>using namespace std;typedef long long ll;multiset<ll>ss;multiset<ll>::iterator it;struct node{ll l;ll r;} a[100100];bool cmp(node x,node y){if(x.l>y.l) return true;else if(x.l==y.l && x.r>y.r) return true;return false;}int main(){ ios::sync_with_stdio(false); int i,j,kk;ll n,k,b,t;ll x1,x2;cin>>n>>x1>>x2;kk=0;for(i=0;i<n;i++) {cin>>k>>b;a[i].l=k*x1+b;a[i].r=k*x2+b;ss.insert(a[i].r);}sort(a,a+n,cmp);for(i=0;i<n;i++) {t=a[i].r;it=ss.upper_bound(t);if(it!=ss.end()) break;ss.erase(ss.lower_bound(t)); // erase()不能删除一个num。。而是删除所有的值为num的 }if(i==n) cout<<"NO"<<endl;else cout<<"YES"<<endl;return 0;}
#include <bits/stdc++.h>using namespace std;typedef long long LL;typedef unsigned long long ULL;const int N=100005;int INF=0x3f3f3f3f;LL mod=1e9+7;LL k[N],b[N],y11[N],y22[N];int a[N],c[N];bool cmp1(int p1,int p2){ if(y11[p1]==y11[p2]){ return y22[p1]<y22[p2]; } return y11[p1]<y11[p2];}bool cmp2(int p1,int p2){ if(y22[p1]==y22[p2]){ return y11[p1]<y11[p2]; } return y22[p1]<y22[p2];}int main(){ int n,x1,x2; scanf("%d%d%d",&n,&x1,&x2); for(int i=0;i<n;i++){ a[i]=c[i]=i; scanf("%I64d%I64d",&k[i],&b[i]); y11[i]=k[i]*x1+b[i]; y22[i]=k[i]*x2+b[i]; } sort(a,a+n,cmp1); sort(c,c+n,cmp2); int ok=1; for(int i=0;i<n;i++){ if(a[i]!=c[i]){ ok=0; break; } } puts(ok?"NO":"YES"); return 0;}
0 0
- cf B. Anton and Lines (STL)
- Code Forces 593 B. Anton and Lines(水~)
- codeforce #329div2 B. Anton and Lines
- Codeforces 593B Anton and Lines 【思维】
- codeforces 593B Anton and Lines
- Codeforces 593B Anton and Lines
- CodeForces 593B - Anton and Lines(思维)
- Codeforces593B. Anton and Lines
- Codeforces Round #329 (Div. 2)B. Anton and Lines
- Codeforces Round #329 (Div. 2)B. Anton and Lines
- Codeforces Round #329 (Div. 2)B. Anton and Lines
- Codeforces Round #329 (Div. 2) 593B - Anton and Lines
- CodeForces 593B Anton and Lines【数学+排序】
- Anton and Permutation CF
- CF 505B(Anton and currency you all know-贪心)
- Codeforces Round #329 (Div. 2) B. Anton and Lines ([好题] 计算直线在区间是否有交点)
- Anton and Lines(模拟,有点贪心的思想)
- CodeForces - 593B Anton and Lines (数学方程&技巧) 判断直线是否相交
- iOS 缓存的路径与缓存
- NumPy的详细教程
- Extjs--点击一个按钮,打开一个新的窗体window重复创建的问题
- BLE按键整理
- ios开发-mac终端命令总集
- cf B. Anton and Lines (STL)
- Flask 即插视图中使用 url_for 获取重定向的目标路径
- 浅析Java中的final关键字
- 语义分析的一些方法(上篇)
- Android项目源代码目录结构
- 使用GCC内置函数代替Linux内核asm/atomic.h头文件
- 语义分析的一些方法(中篇)
- 二叉树的最大深度(LintCode)
- 学习资源