【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 ...
随机推荐
- python_字符串常用操作
name = "monicao"name.capitalize() #首字母大写print(name.capitalize()) print(name.count("o& ...
- windows编程ASCII问题
在CMD中输入CHCP可查看当前使用代码 输入CHCP 65001为UTF-8
- Git:Git入门及基本命令
Git的结构: Git和代码托管中心 局域网环境下: 1)GitLab服务器 外网环境下: 2)github 3)码云 代码托管中心的任务:维护远程库 本地库和远程库的交互 团队内部协作 跨团队协作 ...
- C#-逆变 协变 反射 代码
首先看一段测试代码,自己写的 class Program { static void Main(string[] args) { man OneMan = new man(); var d = One ...
- 记一次在BroadcastReceiver或Service里弹窗的“完美”实践
事情是这样的,目前在做一个医疗项目,需要定时在某个时间段比如午休时间和晚上让我们的App休眠,那么这个时候在休眠时间段如果用户按了电源键点亮屏幕了,我们就需要弹出一个全屏的窗口去做一个人性化的提示,“ ...
- soapUI 5.1.2 下载以及破解
转:https://blog.csdn.net/weiqing723/article/details/78865734
- 剪切具有CornerRadius的RectangleGeometry(可能在Ripple中用到)
剪切具有CornerRadius的RectangleGeometry(可能在Ripple中用到) 1.新建Converter public class BorderClipConverter : IM ...
- bzoj4519: [Cqoi2016]不同的最小割(分治最小割)
4519: [Cqoi2016]不同的最小割 题目:传送门 题解: 同BZOJ 2229 基本一样的题目啊,就最后用set记录一下就ok 代码: #include<cstdio> #inc ...
- xBIM 基础14 使用LINQ实现最佳性能(优化查询)
系列目录 [已更新最新开发文章,点击查看详细] LINQ代表语言集成查询,它是3.5版以来的.NET Framework的一部分.它实现延迟执行,这意味着您可以链接查询语句,并且在您实际迭代结 ...
- C++线程安全退出
HANDLE m_EvtThreadExit[MaxVisionNum]; //定义 方法一 ;i<MaxVisionNum;i++) m_EvtThreadExit[index] = Crea ...