#include <algorithm>
#include <iostream>
#include <cstdio>
using namespace std;
long long N = 1e+9 +7 , Pow[1200];
struct point{
long long x, y;
friend bool operator <(point& a, point& b){
if(a.y == b.y) return a.x < b.x;
return a.y < b.y;
}
friend bool operator ==(point& a, point& b){
return a.x == b.x && a.y == b.y;
}
};
point pb, p[1200];
bool cmp(const point& p1, const point& p2){
return (p1.x-pb.x)*(p2.y-pb.y) - (p2.x-pb.x)*(p1.y-pb.y) < 0;
}
bool cmp2(const point& p1, const point& p2){
return (p1.x-pb.x)*(p2.y-pb.y) - (p2.x-pb.x)*(p1.y-pb.y) == 0;
}
void init()
{
Pow[0] = 1;
for(int i = 1; i < 1100; i++)
Pow[i] = Pow[i-1]*2%N;
}
int main()
{
int t, m, n, x, y, k, cnt;
long long sum, s;
init();
scanf("%d",&t);
while(t--)
{
sum = 0;
scanf("%d",&n);
for(int i = 0; i < n; i++)
scanf("%I64d%I64d",&p[i].x, &p[i].y);
k = 1;
for(int i = 0;i < n; i++)
{
sort(p+i, p+n);
if(i < n-1 && p[i] == p[i+1]){
++k; continue;
}
if(i == n-1){
cnt = 0;
s = ((Pow[k] + N-1)%N) * ((Pow[cnt] + N-1)%N) %N;
s = (s + Pow[k] + N-k-1) %N;
sum = (sum + s) %N;
break;
}
pb = p[i];
sort(p+i+1, p+n, cmp);
cnt = 1;
for(int j = i+1; j < n; j++){
if(j < n-1 && cmp2(p[j], p[j+1])){
++cnt; continue;
}
s = ((Pow[k] + N-1)%N) * ((Pow[cnt] + N-1)%N) %N;
sum = (sum + s) %N;
cnt = 1;
}
sum = (sum + Pow[k] + N-k-1) %N;
k = 1;
}
cout << sum << endl;
}
return 0;
}
/*
贡献两组测试数据
4
1 1 1 1
0 0 2 1
ans = 8
5
1 1 1 1
0 0 0 0
2 1
ans = 17
*/
hdu 5738 Eureka
最新推荐文章于 2016-07-28 10:04:13 发布