# 2018 ACM 国际大学生程序设计竞赛上海大都会赛重现赛 A Fruit Ninja

#include<bits/stdc++.h>
//CLOCKS_PER_SEC
#define se second
#define fi first
#define ll long long
#define Pii pair<int,int>
#define Pli pair<ll,int>
#define ull unsigned long long
#define pb push_back
#define fio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
const double Pi=3.14159265;
const int N=1e4+10;
const ull base=163;
const int INF=0x3f3f3f3f;
const ll mod=1e9+7;
using namespace std;
Pii p[N];
int main(){
int T;scanf("%d",&T);
while(T--){
int n;double X;scanf("%d%lf",&n,&X);
for(int i=1;i<=n;i++){
scanf("%d%d",&p[i].fi,&p[i].se);
}
if(n<=2){
puts("Yes\n");
continue;
}
int m=ceil(n*X);
int flag=0;
for(int pp=0;pp<1000;pp++){
int x=rand()%n+1,y=rand()%n+1;
while(y==x)y=rand()%n+1;
double a=1.0*(p[y].se-p[x].se)/(p[y].fi-p[x].fi);
// cout<<"a. "<<a<<endl;
int s=2;
for(int j=1;j<=n;j++){
if(j==x||j==y)continue;
double b=1.0*(p[j].se-p[x].se)/(p[j].fi-p[x].fi);
// cout<<b<<endl;
if(b==a)s++;
if(s>=m){
flag=1;
break;
}
}
if(flag==1)break;
}
if(flag)puts("Yes");
else puts("No");
}
return 0;
}

posted @ 2018-08-05 20:37  采蘑菇的小西佬  阅读(178)  评论(0编辑  收藏