【链接】 我是链接,点我呀:)

【题意】

在这里输入题意

【题解】

如果点的个数

【代码】

#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的更多相关文章

  1. 【 Educational Codeforces Round 51 (Rated for Div. 2) F】The Shortest Statement

    [链接] 我是链接,点我呀:) [题意] [题解] 先处理出来任意一棵树. 然后把不是树上的边处理出来 对于每一条非树边的点(最多21*2个点) 在原图上,做dijkstra 这样就能处理出来这些非树 ...

  2. 【Educational Codeforces Round 53 (Rated for Div. 2) C】Vasya and Robot

    [链接] 我是链接,点我呀:) [题意] [题解] 如果|x|+|y|>n 显然.从(0,0)根本就没法到(x,y) 但|x|+|y|<=n还不一定就能到达(x,y) 注意到,你每走一步路 ...

  3. 【Educational Codeforces Round 48 (Rated for Div. 2) C】 Vasya And The Mushrooms

    [链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 显然在没有一直往右走然后走到头再往上走一格再往左走到头之前. 肯定是一直在蛇形走位.. 这个蛇形走位的答案贡献可以预处理出来.很容易 ...

  4. 【Educational Codeforces Round 48 (Rated for Div. 2) D】Vasya And The Matrix

    [链接] 我是链接,点我呀:) [题意] 告诉你每一行.每一列的异或和. 让你求出一个符合要求的原矩阵. [题解] 显然应该有 a1^a2^....^an = b1^b2^....^bn 也即两边同时 ...

  5. 【Educational Codeforces Round 38 (Rated for Div. 2)】 Problem A-D 题解

    [比赛链接] 点击打开链接 [题解] Problem A Word Correction[字符串] 不用多说了吧,字符串的基本操作 Problem B  Run for your prize[贪心] ...

  6. 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 ...

  7. Educational Codeforces Round 41 (Rated for Div. 2)F. k-substrings

    题意比较麻烦略 题解:枚举前缀的中点,二分最远能扩展的地方,lcp来check,然后线段树维护每个点最远被覆盖的地方,然后查询线段树即可 //#pragma GCC optimize(2) //#pr ...

  8. Educational Codeforces Round 41 (Rated for Div. 2)(A~D)

    由于之前打过了这场比赛的E题,而后面两道题太难,所以就手速半个多小时A了前4题. 就当练手速吧,不过今天除了C题数组开小了以外都是1A A Tetris 题意的抽象解释可以在Luogu里看一下(话说现 ...

  9. Educational Codeforces Round 41 (Rated for Div. 2)

    这场没打又亏疯了!!! A - Tetris : 类似俄罗斯方块,模拟一下就好啦. #include<bits/stdc++.h> #define fi first #define se ...

随机推荐

  1. js常用特效-幻灯片

    <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...

  2. linux中fork()函数详解(搬砖)

    一.fork入门知识 一个进程,包括代码.数据和分配给进程的资源.fork()函数通过系统调用创建一个与原来进程几乎完全相同的进程,也就是两个进程可以做完全相同的事,但如果初始参数或者传入的变量不同, ...

  3. WinServer-IIS-woff字体不显示问题

    ASP.NET mvc发布到IIS之后,访问网站的时候,发现woff字体没有加载 百度发现很多博客上的教程是这样的,在IIS管理器中的MIME选项中添加类型 但是重新使用IIS发布后,新添加的字体就会 ...

  4. oracle刚開始学习的人经常使用操作100问

    oracle刚開始学习的人经常使用操作100问 1. Oracle安装完毕后的初始口令?   internal/oracle sys/change_on_install system/manager ...

  5. Hibernate关系映射中的注解

    一.@Entity 写在映射表的类上面,表示这是映射来的实体 二.@Id @Column(name = "fid", nullable = false) @Basic @Colum ...

  6. FireFox所支持的全部标签(持续更新ing)

    近期研究上各个浏览器的差别,得到一些资料,FireFox眼下所支持的全部标签类型,持续更新,供大家參考和学习,不喜勿喷哦 http://mxr.mozilla.org/seamonkey/source ...

  7. php中echo什么时候用到\"这个符号

    php中echo什么时候用到\"这个符号 当在引号中用到引号时,为避免混乱用\" \称为转义符,表示后面的字符和原来程序语言里的语法符号含义不同 常见的转义有 \" \' ...

  8. Oracle 10g RAC (linux) ASM 共享存储的管理详解

    ---------ASM 的管理(共享磁盘的管理)1.以 instance 的方式管理 ASM,启动 database 之前必须先启动 ASM instance,ASM instance 启动后,挂载 ...

  9. 1. Git-2.12.0-64-bit .exe下载

    转自:https://blog.csdn.net/u011164906/article/details/59129835 之前一直用SVN最近接触git,Git-2.12.0-64-bit .exe文 ...

  10. BZOJ 2194 FFT

    思路: 题目中给的是差值一定的 那么就把b数组倒一下 不就变成 i+j=k(k为定值的了嘛) 嗯 然后搞个FFT //By SiriusRen #include <cstdio> #inc ...