# codeforces_961D_ Pair Of Lines+849B_Tell Your World（数学+直线）

#include<bits/stdc++.h>
#define debug(a) cout << #a << " " << a << endl
#define LL long long
#define ull unsigned long long
#define PI acos(-1.0)
#define eps 1e-6
const int N=1e5+7;
using namespace std;
int y[N],n;
bool ok(int a,int b,int c,int d)
{
return (b-a)*(y[d]-y[c])==(d-c)*(y[b]-y[a]);
}
bool check(int x,int y)
{
vector<int> stk;
for(int i=1;i<=n;i++)
if(!ok(x,y,y,i) && i!=y) stk.push_back(i);
if(stk.size()==0) return 0;
for(int i=1;i<(int)stk.size();i++)
if(!ok(x,y,stk[i-1],stk[i])) return 0;
return 1;
}
int main ()
{
//yyy_3y
//freopen("1.in","r",stdin);
scanf("%d",&n);
for(int i=1;i<=n;i++) scanf("%d",&y[i]);
if(check(1,2) || check(1,3) || check(2,3)) puts("Yes");
else puts("No");
return 0;
}



Pair Of Lines

#include<bits/stdc++.h>
#define debug(a) cout << #a << " " << a << endl
#define LL long long
#define ull unsigned long long
#define PI acos(-1.0)
#define eps 1e-6
const int N=1e5+7;
using namespace std;
LL x[N],y[N],n;
bool ok(int a,int b,int c,int d)
{
return (y[b]-y[a])*(x[d]-x[c])==(y[d]-y[c])*(x[b]-x[a]);
}
bool check(int x,int y)
{
vector<int> stk;
for(int i=1;i<=n;i++){
if(!ok(x,y,y,i))
stk.push_back(i);
}
if(stk.size()<=2) return 1;
x=stk[0],y=stk[1];
for(int i=2;i<(int)stk.size();i++){
if(!ok(x,y,y,stk[i])) return 0;
}
return 1;
}
int main ()
{
//yyy_3y
//freopen("1.in","r",stdin);
scanf("%d",&n);
for(int i=1;i<=n;i++){
scanf("%lld%lld",&x[i],&y[i]);
}
if(n<=4 || check(1,2) || check(1,3) || check(2,3)) puts("YES");
else puts("NO");
return 0;
}



• 广告
• 抄袭
• 版权
• 政治
• 色情
• 无意义
• 其他

120