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

【题意】

在这里输入题意

【题解】

如果点的个数

【代码】

  1. #include <bits/stdc++.h>
  2. #define LL long long
  3. #define rep1(i,a,b) for (int i = a;i <= b;i++)
  4. #define rep2(i,a,b) for (int i = a;i >= b;i--)
  5. #define all(x) x.begin(),x.end()
  6. #define pb push_back
  7. #define lson l,mid,rt<<1
  8. #define rson mid+1,r,rt<<1|1
  9. using namespace std;
  10. const double pi = acos(-1);
  11. const int dx[4] = {0,0,1,-1};
  12. const int dy[4] = {1,-1,0,0};
  13. const int N = 1e5;
  14. pair<int,int> a[N+10];
  15. vector<pair<int,int> > v;
  16. int n;
  17. bool online(int x1,int y1,int x2,int y2,int x3,int y3){
  18. LL temp1 = 1LL*(x3-x1)*(y2-y1);
  19. LL temp2 = 1LL*(y3-y1)*(x2-x1);
  20. if (temp1==temp2){
  21. return true;
  22. }else return false;
  23. }
  24. bool judge(int idx1,int idx2){
  25. int x1,y1,x2,y2;
  26. x1 = a[idx1].first,y1 = a[idx1].second,x2 = a[idx2].first,y2 = a[idx2].second;
  27. v.clear();
  28. for (int i = 1;i <= n;i++)
  29. if (i!=idx1 && i!=idx2){
  30. int x3,y3;
  31. x3 = a[i].first,y3 = a[i].second;
  32. if (online(x1,y1,x2,y2,x3,y3)) continue;
  33. v.push_back(a[i]);
  34. }
  35. if ( (int) v.size()<=2){
  36. return true;
  37. }else{
  38. x1 = v[0].first,y1 = v[0].second,x2 = v[1].first,y2 = v[1].second;
  39. for (int i = 2;i < (int)v.size();i++){
  40. int x3,y3;
  41. x3 = v[i].first,y3 = v[i].second;
  42. if (online(x1,y1,x2,y2,x3,y3)) continue;
  43. return false;
  44. }
  45. return true;
  46. }
  47. }
  48. int main(){
  49. #ifdef LOCAL_DEFINE
  50. freopen("rush_in.txt", "r", stdin);
  51. #endif
  52. ios::sync_with_stdio(0),cin.tie(0);
  53. cin >> n;
  54. rep1(i,1,n) cin >> a[i].first >> a[i].second;
  55. if(n<=3){
  56. cout<<"YES"<<endl;
  57. }else{
  58. if (judge(1,3)||judge(1,2)||judge(2,3)) cout<<"YES"<<endl;
  59. else cout<<"NO"<<endl;
  60. }
  61. return 0;
  62. }

【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. python_字符串常用操作

    name = "monicao"name.capitalize() #首字母大写print(name.capitalize()) print(name.count("o& ...

  2. windows编程ASCII问题

    在CMD中输入CHCP可查看当前使用代码 输入CHCP 65001为UTF-8

  3. Git:Git入门及基本命令

    Git的结构: Git和代码托管中心 局域网环境下: 1)GitLab服务器 外网环境下: 2)github 3)码云 代码托管中心的任务:维护远程库 本地库和远程库的交互 团队内部协作 跨团队协作 ...

  4. C#-逆变 协变 反射 代码

    首先看一段测试代码,自己写的 class Program { static void Main(string[] args) { man OneMan = new man(); var d = One ...

  5. 记一次在BroadcastReceiver或Service里弹窗的“完美”实践

    事情是这样的,目前在做一个医疗项目,需要定时在某个时间段比如午休时间和晚上让我们的App休眠,那么这个时候在休眠时间段如果用户按了电源键点亮屏幕了,我们就需要弹出一个全屏的窗口去做一个人性化的提示,“ ...

  6. soapUI 5.1.2 下载以及破解

    转:https://blog.csdn.net/weiqing723/article/details/78865734

  7. 剪切具有CornerRadius的RectangleGeometry(可能在Ripple中用到)

    剪切具有CornerRadius的RectangleGeometry(可能在Ripple中用到) 1.新建Converter public class BorderClipConverter : IM ...

  8. bzoj4519: [Cqoi2016]不同的最小割(分治最小割)

    4519: [Cqoi2016]不同的最小割 题目:传送门 题解: 同BZOJ 2229 基本一样的题目啊,就最后用set记录一下就ok 代码: #include<cstdio> #inc ...

  9. xBIM 基础14 使用LINQ实现最佳性能(优化查询)

    系列目录    [已更新最新开发文章,点击查看详细]  LINQ代表语言集成查询,它是3.5版以来的.NET Framework的一部分.它实现延迟执行,这意味着您可以链接查询语句,并且在您实际迭代结 ...

  10. C++线程安全退出

    HANDLE m_EvtThreadExit[MaxVisionNum]; //定义 方法一 ;i<MaxVisionNum;i++) m_EvtThreadExit[index] = Crea ...