This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define rng(i,x,n) for(int i=x;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define fi first
#define se second
#define pb push_back
#define sz(a) (int)a.size()
#define vec(...) vector<__VA_ARGS__>
#define _3HspL4A ios::sync_with_stdio(0),cin.tie(0)
typedef long long ll;
using pii=pair<int,int>;
using vi=vec(int);
void print(){cout<<"\n";}
template<class T,class...E>
void print(const T&v,const E&...u){cout<<v<<' ',print(u...);}
// e
//snuke's mod int
template <ll mod>
struct modint{
ll x; // typedef long long ll;
modint(ll x=0):x((x%mod+mod)%mod){}
modint operator-()const{return modint(-x);}
modint& operator+=(const modint a){if((x+=a.x)>=mod) x-=mod; return *this;}
modint& operator-=(const modint a){if((x+=mod-a.x)>=mod) x-=mod; return *this;}
modint& operator*=(const modint a){(x*=a.x)%=mod; return *this;}
modint operator+(const modint a)const{modint res(*this); return res+=a;}
modint operator-(const modint a)const{modint res(*this); return res-=a;}
modint operator*(const modint a)const{modint res(*this); return res*=a;}
modint pow(ll n)const{
modint res=1,x(*this);
while(n){
if(n&1)res*=x;
x*=x;
n>>=1;
}
return res;
}
modint inv()const{return pow(mod-2);}
};
using mint=modint<1000'000'007>;
using ld=long double;
struct P{
ld x,y;
P(ld _x=0,ld _y=0):x(_x),y(_y){}
P operator+(const P &p){ return {x+p.x,y+p.y}; }
P operator-(const P &p){ return {x-p.x,y-p.y}; }
P operator*(ld d){ return {x*d,y*d}; }
P operator/(ld d){ return {x/d,y/d}; } // d!=0
bool operator==(const P &p)const{ return x==p.x and y==p.y; }
bool operator<(const P &p)const{ return x!=p.x?x<p.x:y<p.y; }
ld norm(){ return x*x+y*y; }
ld abs(){ return sqrt(norm()); }
};
ld dist(P a,P b){
return (a-b).abs();
}
ld ccw(P a,P b,P c){
return a.x*(b.y-c.y)+b.x*(c.y-a.y)+c.x*(a.y-b.y);
}
signed main(){
_3HspL4A;
int n;
cin>>n;
vec(P) a;
rep(i,n){
int x,y; cin>>x>>y;
a.pb(P(x,y));
}
mint ans=0;
auto quq=[&](int pivot){
vec(P) hi,lo;
rep(i,n){
if(i==pivot) continue;
P pnt=a[i]-a[pivot];
if(pnt.y>=0) hi.pb(pnt);
else lo.pb(pnt);
}
sort(hi.begin(),hi.end());
sort(lo.begin(),lo.end());
P pnt(0,0);
int nhi=sz(hi),nlo=sz(lo);
// print(pivot);
rep(i,nhi){
int now=nhi-i;
for(auto p:lo){
if(ccw(pnt,hi[i],p)<0){
now+=1;
}
}
// cout<<now-1<<" ";
ans-=mint(2).pow(now-1);
}
// print("\n....\n");
per(i,nlo){
int now=nlo-i;
for(auto p:hi){
if(ccw(lo[i],p,pnt)<0){
print(p.x,p.y);
now+=1;
}
}
// cout<<now-1<<" ";
ans-=mint(2).pow(now-1);
}
// print("\nqqqqqq");
// vi toh(nhi);
// {
// int j=nlo-1;
// rep(i,nhi){
// while(j>=0 and ccw(hi[i],pnt,lo[j])>0){
// j-=1;
// }
// toh[i]=j;
// }
// }
// vi tol(nlo);
// {
// int j=-1;
// per(i,nlo){
// while(j+1<nhi and ccw(lo[i],pnt,hi[j+1])>0){
// j+=1;
// }
// tol[i]=j;
// }
// // print(ccw(hi[nhi-1],pnt,lo[0]));
// }
// rep(i,nlo){
// ans-=mint(2).pow(nlo-i+tol[i]+1-1);
// }
// rep(i,nhi){
// // print(hi[i].x,hi[i].y);
// ans-=mint(2).pow(nhi-i+nlo-(toh[i]+1)-1);
// }
ans-=1;
};
// quq(0);
rep(i,n){
quq(i);
}
ans+=mint(2).pow(n)*n;
print(ans.x);
//
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |