UOJ 265(NOIP2016)
4017 단어 dp
#include
#include
#include
#include
using namespace std;
#define eps 1e-10
const int INF=0x3f3f3f3f;
int n,waste,f[1200000],st[300],tot;
struct MPro {
double x,y;
}p[20];
inline void init() {
memset(f,INF,sizeof(f));
memset(st,0,sizeof(st));
tot=f[0]=0;
for (int i=1;i<=n;++i)
for (int j=i;j<=n;++j) {
++tot;
if (i^j) {
double t=p[i].x/p[j].x,t2=p[j].x*p[i].x-p[i].x*p[i].x,t3=p[j].y*t-p[i].y;
double a=t3/t2;
if (a>-eps) continue;
double b=-(a*p[i].x*p[i].x-p[i].y)/p[i].x;
for (int k=1;k<=n;++k)
if (a*p[k].x*p[k].x+b*p[k].xp[k].y-eps)
st[tot]+=1<1;
}
else st[tot]=1<1;
}
}
int main() {
int kase;
scanf("%d",&kase);
while (kase--) {
scanf("%d%d",&n,&waste);
for (int i=1;i<=n;++i) scanf("%lf%lf",&p[i].x,&p[i].y);
init();
for (int i=0;i1<for (int j=1;j<=tot;++j)
/*if (!(i&st[j]))*/f[i|st[j]]=min(f[i|st[j]],f[i]+1);
printf("%d
",f[(1<1]);
}
return 0;
}