D. Pair Of Lines( Educational Codeforces Round 41 (Rated for Div. 2))
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;
const int N = 1e5 + ;
ll x[N], y[N];
int n; bool gx(int a, int b, int c, int d)
{
return (x[b] - x[a])*(y[d] - y[c]) == (x[d] - x[c])*(y[b] - y[a]);
} int check(int d, int f)
{
vector<int>q;
for (int i = ; i <= n; i++)
if (!gx(d, f, f, i))
q.push_back(i);
if (q.size()<) return ;
for (int i = ; i<q.size(); i++)
if (!gx(q[],q[], q[], q[i]))
return ;
return ;
} int main()
{
cin >> n;
for (int i = ; i <= n; i++)
cin >> x[i] >> y[i];
if (n< || check(, ) || check(, ) || check(, ))
cout << "YES" << endl;
else cout << "NO" <<endl;
//system("pause");
return ;
}
D. Pair Of Lines( Educational Codeforces Round 41 (Rated for Div. 2))的更多相关文章
- C. Chessboard( Educational Codeforces Round 41 (Rated for Div. 2))
//暴力 #include <iostream> #include <algorithm> #include <string> using namespace st ...
- B. Lecture Sleep( Educational Codeforces Round 41 (Rated for Div. 2))
前缀后缀和搞一搞,然后枚举一下区间,找出最大值 #include <iostream> #include <algorithm> using namespace std; ; ...
- (模拟)关于进制的瞎搞---You Are Given a Decimal String...(Educational Codeforces Round 70 (Rated for Div. 2))
题目链接:https://codeforc.es/contest/1202/problem/B 题意: 给你一串数,问你插入最少多少数可以使x-y型机器(每次+x或+y的机器,机器每次只取最低位--% ...
- Educational Codeforces Round 41 (Rated for Div. 2) D. Pair Of Lines (几何,随机)
D. Pair Of Lines time limit per test 2 seconds memory limit per test 256 megabytes input standard in ...
- 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) ABCDEF
最近打的比较少...就只有这么点题解了. A. Tetris time limit per test 1 second memory limit per test 256 megabytes inpu ...
- Educational Codeforces Round 41 (Rated for Div. 2)
这场没打又亏疯了!!! A - Tetris : 类似俄罗斯方块,模拟一下就好啦. #include<bits/stdc++.h> #define fi first #define se ...
- 【Educational Codeforces Round 41 (Rated for Div. 2) D】Pair Of Lines
[链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 如果点的个数<=3 那么直接输出有解. 否则. 假设1,2最后会在一条直线上,则把这条直线上的点都删掉. 看看剩余的点是否在同 ...
- Multidimensional Queries(二进制枚举+线段树+Educational Codeforces Round 56 (Rated for Div. 2))
题目链接: https://codeforces.com/contest/1093/problem/G 题目: 题意: 在k维空间中有n个点,每次给你两种操作,一种是将某一个点的坐标改为另一个坐标,一 ...
随机推荐
- BZOJ 2069 POI2004 ZAW 堆优化Dijkstra
题目大意:给定一张无向图.每条边从两个方向走各有一个权值,求从点1往出走至少一步之后回到点1且不经过一条边多次的最短路 显然我们须要从点1出发走到某个和点1相邻的点上,然后沿最短路走到还有一个和点1相 ...
- CodeForces - 450B Jzzhu and Sequences —— 斐波那契数、矩阵快速幂
题目链接:https://vjudge.net/problem/CodeForces-450B B. Jzzhu and Sequences time limit per test 1 second ...
- UVA10561 Treblecross —— SG博弈
题目链接:https://vjudge.net/problem/UVA-10561 题意: 两个人玩游戏,轮流操作:每次往里面添加一个X,第一个得到XXX的获胜. 题解: 详情请看<训练指南&g ...
- Codeforces Round #363 (Div. 2) B. One Bomb —— 技巧
题目链接:http://codeforces.com/contest/699/problem/B 题解: 首先统计每行每列出现'*'的次数,以及'*'出现的总次数,得到r[n]和c[m]数组,以及su ...
- 存储过程系列三:根据表别名方式distinct去重插入
1.根据表别名方式distinct去重插入 insert into GG_XKZ_YLQXSCXKESL_SCDZ ( bzj, xkzid, sqid, jtdz, szsf, ...
- map的详细用法 (转
map的详细用法: map是STL的一个关联容器,它提供一对一(其中第一个可以称为关键字,每个关键字只能在map中出现一次,第二个可能称为该关键字的值)的数据处理能 力,由于这个特性,它完成有可能在我 ...
- eclipse Tomcat 启动报错
如果之前启动都是正常的,更新完后端代码后启动Tomcat报错,又没有错误的日志提示. 尝试先把Tomcat里面的项目删掉,然后点击Tomcat右键,Clean清除缓存,再把项目Add: 重新启动!
- Linux终端程序用c语言实现改变输出的字的颜色
颜色代码: 格式: echo "\033[字背景颜色;字体颜色m字符串\033[0m" 例如: echo "\033[41;36m something here \033 ...
- 编写 DockerFile
编写 DockerFile 本节内容简介 在前面的实验中我们多次用到的 Dockerfile,在本实验里我们将通过完成一个实例来学习Dockerfile的编写. 本节中,我们需要依次完成下面几项任务: ...
- Ubuntu 无法登录 coursera 看视频
修改 host 文件 sudo vim /etc/hosts 将下面的内容添加至末尾 52.84.246.72 d3c33hcgiwev3.cloudfront.net