【Educational Codeforces Round 41 (Rated for Div. 2) D】Pair Of Lines
【链接】 我是链接,点我呀:)
【题意】
在这里输入题意
【题解】
如果点的个数
【代码】
#include <bits/stdc++.h>
#define LL long long
#define rep1(i,a,b) for (int i = a;i <= b;i++)
#define rep2(i,a,b) for (int i = a;i >= b;i--)
#define all(x) x.begin(),x.end()
#define pb push_back
#define lson l,mid,rt<<1
#define rson mid+1,r,rt<<1|1
using namespace std;
const double pi = acos(-1);
const int dx[4] = {0,0,1,-1};
const int dy[4] = {1,-1,0,0};
const int N = 1e5;
pair<int,int> a[N+10];
vector<pair<int,int> > v;
int n;
bool online(int x1,int y1,int x2,int y2,int x3,int y3){
LL temp1 = 1LL*(x3-x1)*(y2-y1);
LL temp2 = 1LL*(y3-y1)*(x2-x1);
if (temp1==temp2){
return true;
}else return false;
}
bool judge(int idx1,int idx2){
int x1,y1,x2,y2;
x1 = a[idx1].first,y1 = a[idx1].second,x2 = a[idx2].first,y2 = a[idx2].second;
v.clear();
for (int i = 1;i <= n;i++)
if (i!=idx1 && i!=idx2){
int x3,y3;
x3 = a[i].first,y3 = a[i].second;
if (online(x1,y1,x2,y2,x3,y3)) continue;
v.push_back(a[i]);
}
if ( (int) v.size()<=2){
return true;
}else{
x1 = v[0].first,y1 = v[0].second,x2 = v[1].first,y2 = v[1].second;
for (int i = 2;i < (int)v.size();i++){
int x3,y3;
x3 = v[i].first,y3 = v[i].second;
if (online(x1,y1,x2,y2,x3,y3)) continue;
return false;
}
return true;
}
}
int main(){
#ifdef LOCAL_DEFINE
freopen("rush_in.txt", "r", stdin);
#endif
ios::sync_with_stdio(0),cin.tie(0);
cin >> n;
rep1(i,1,n) cin >> a[i].first >> a[i].second;
if(n<=3){
cout<<"YES"<<endl;
}else{
if (judge(1,3)||judge(1,2)||judge(2,3)) cout<<"YES"<<endl;
else cout<<"NO"<<endl;
}
return 0;
}
【Educational Codeforces Round 41 (Rated for Div. 2) D】Pair Of Lines的更多相关文章
- 【 Educational Codeforces Round 51 (Rated for Div. 2) F】The Shortest Statement
[链接] 我是链接,点我呀:) [题意] [题解] 先处理出来任意一棵树. 然后把不是树上的边处理出来 对于每一条非树边的点(最多21*2个点) 在原图上,做dijkstra 这样就能处理出来这些非树 ...
- 【Educational Codeforces Round 53 (Rated for Div. 2) C】Vasya and Robot
[链接] 我是链接,点我呀:) [题意] [题解] 如果|x|+|y|>n 显然.从(0,0)根本就没法到(x,y) 但|x|+|y|<=n还不一定就能到达(x,y) 注意到,你每走一步路 ...
- 【Educational Codeforces Round 48 (Rated for Div. 2) C】 Vasya And The Mushrooms
[链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 显然在没有一直往右走然后走到头再往上走一格再往左走到头之前. 肯定是一直在蛇形走位.. 这个蛇形走位的答案贡献可以预处理出来.很容易 ...
- 【Educational Codeforces Round 48 (Rated for Div. 2) D】Vasya And The Matrix
[链接] 我是链接,点我呀:) [题意] 告诉你每一行.每一列的异或和. 让你求出一个符合要求的原矩阵. [题解] 显然应该有 a1^a2^....^an = b1^b2^....^bn 也即两边同时 ...
- 【Educational Codeforces Round 38 (Rated for Div. 2)】 Problem A-D 题解
[比赛链接] 点击打开链接 [题解] Problem A Word Correction[字符串] 不用多说了吧,字符串的基本操作 Problem B Run for your prize[贪心] ...
- CF codeforces A. New Year Garland【Educational Codeforces Round 79 (Rated for Div. 2)】
A. New Year Garland time limit per test 1 second memory limit per test 256 megabytes input standard ...
- Educational Codeforces Round 41 (Rated for Div. 2)F. k-substrings
题意比较麻烦略 题解:枚举前缀的中点,二分最远能扩展的地方,lcp来check,然后线段树维护每个点最远被覆盖的地方,然后查询线段树即可 //#pragma GCC optimize(2) //#pr ...
- Educational Codeforces Round 41 (Rated for Div. 2)(A~D)
由于之前打过了这场比赛的E题,而后面两道题太难,所以就手速半个多小时A了前4题. 就当练手速吧,不过今天除了C题数组开小了以外都是1A A Tetris 题意的抽象解释可以在Luogu里看一下(话说现 ...
- Educational Codeforces Round 41 (Rated for Div. 2)
这场没打又亏疯了!!! A - Tetris : 类似俄罗斯方块,模拟一下就好啦. #include<bits/stdc++.h> #define fi first #define se ...
随机推荐
- HDU 1042 N!( 高精度乘法水 )
链接:传送门 思路:高精度乘法板子题,高精度耗时又耗空间...... /**************************************************************** ...
- POJ 3517 And Then There Was One( 约瑟夫环模板 )
链接:传送门 题意:典型约瑟夫环问题 约瑟夫环模板题:n个人( 编号 1-n )在一个圆上,先去掉第m个人,然后从m+1开始报1,报到k的人退出,剩下的人继续从1开始报数,求最后剩的人编号 /**** ...
- 模板 NTT 快速数论变换
NTT裸模板,没什么好解释的 这种高深算法其实也没那么必要知道原理 #include <cstdio> #include <cstring> #include <algo ...
- Consider defining a bean of type 'XX.XX.XX.XX.mapper.XXMapper' in your configuration.
今天构建一个springboot 项目,采用mybatis+mysql 然后就出现了这种错误....浪费我半天时间 Description: Field loginLogMapper in com.g ...
- 启用Maven的代理访问
1. Maven配置文件 找到文件 {M2_HOME}/conf/settings.xml, 并把你的代理服务器信息配置写入.注:{M2_HOME} => D:\software\yiibai. ...
- 2019-03-14 Python爬虫问题 爬取网页的汉字打印出来乱码
html = requests.get(YieldCurveUrl, headers=headers) html=html.content.decode('UTF-8') # print(html) ...
- HDU 4331 Contest 4
一个很直观的想法是,求出每个点上下左右能到达的最大长度.然后枚举其斜边...没想到过了.... 当然,题解有一个很巧妙的优化,利用树状数组,那个太巧妙了. #include<iostream&g ...
- C++的标准模板库STL中实现的数据结构之链表std::list的分析与使用
摘要 本文主要借助对C++的标准模板库STL中实现的数据结构的学习和使用来加深对数据结构的理解,即联系数据结构的理论分析和详细的应用实现(STL),本文是系列总结的第二篇.主要针对线性表中的链表 ST ...
- 任务调度器quartz的使用
1.quartz的获取. 可參照:Quartz任务调度模型实例 2.开发思路: 要使用定时器quartz.先弄清楚三个概念:调度器.任务.触发器.开发也是依照这三个方面来开发, 1>写一个Job ...
- atitit。流程图的设计与制作 attilax 总结
atitit.流程图的设计与制作 attilax 总结 1. 流程图的规范1 2. 画图语言2 2.1. atitit.CSDN-markdown编辑器2 2.2. js-sequence-diagr ...