Codeforces 961 D Pair Of Lines】的更多相关文章

题目描述 You are given nn points on Cartesian plane. Every point is a lattice point (i. e. both of its coordinates are integers), and all points are distinct. You may draw two straight lines (not necessarily distinct). Is it possible to do this in such a…
You are given n points on Cartesian plane. Every point is a lattice point (i. e. both of its coordinates are integers), and all points are distinct. You may draw two straight lines (not necessarily distinct). Is it possible to do this in such a way t…
D. Pair Of Lines time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output You are given n points on Cartesian plane. Every point is a lattice point (i. e. both of its coordinates are integers), and…
[链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 如果点的个数<=3 那么直接输出有解. 否则. 假设1,2最后会在一条直线上,则把这条直线上的点都删掉. 看看剩余的点是否在同一条直线上,是的话输出有解. 否则再假设1,3最后会在一条直线上,同样的看看这条直线之外的点是否 在同一条直线上. 是的话同样输出有解. 否则,因为前两种都没有解,那就说明1和2不共线,且1和3不共线,而只有两条线,且要穿过所有点. 那么就说明2,3肯定是只能在一条线上了,然后1分另外一条线. 把2,3用…
#include <vector> #include <iostream> #include <algorithm> using namespace std; typedef long long ll; ; 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…
[题意概述] 给出平面上的10W个点,要求判断这些点能否被两条直线穿过,即一个点至少在一条直线上. [题解] 思路很快可以想到.取3个不共线的点,它们形成一个三角形:如果有解,其中的一条直线一定与三角形的一条边重合.于是用这三条边一一进行验证即可. 第一次交被卡了精度,后来意识到判断三个点是否共线写丑了,其实并不需要求解析式.直接运用相似三角形,移项变成乘法即可. #include<cstdio> #include<algorithm> #include<cstring>…
D. Pair of Numbers time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Simon has an array a1, a2, ..., an, consisting of n positive integers. Today Simon asked you to find a pair of integers l…
题目描述 You are given n n n points on Cartesian plane. Every point is a lattice point (i. e. both of its coordinates are integers), and all points are distinct. You may draw two straight lines (not necessarily distinct). Is it possible to do this in suc…
B. Pair of Toys 智障题目(嘤嘤嘤~) 代码: 1 //B 2 #include<iostream> 3 #include<cstdio> 4 #include<cstring> 5 #include<algorithm> 6 #include<bitset> 7 #include<cassert> 8 #include<cctype> 9 #include<cmath> 10 #include&…
Discription One day Polycarp decided to rewatch his absolute favourite episode of well-known TV series "Tufurama". He was pretty surprised when he got results only for season 7 episode 3 with his search query of "Watch Tufurama season 3 epi…