随机算法 题目链接 https://icpcarchive.ecs.baylor.edu/external/69/6955.pdf
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5+10;
struct node{
int x, y;
}p[N];
int n, s;
bool check(int x, int y)
{
int k =0;
for(int i = 0;i < n; i++) {
if((p[i].y-p[x].y)*(p[i].x-p[y].x)-((p[i].x-p[x].x)*(p[i].y-p[y].y))==0) k++;
}
return k >= (n*s+99)/100;
}
int main()
{
while(~scanf("%d%d",&n,&s)) {
for(int i = 0;i < n; i++) {
scanf("%d%d",&p[i].x,&p[i].y);
}
bool flag = false;
for(int i = 0;i < 1000; i++) {
int x = rand()%n;
int y = rand()%n;
if(x == y) continue;
if(check(x,y)) flag = true;
}
if(flag || n<=2) puts("possible");
else puts("impossible");
}
return 0;
}