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());
int nhi=sz(hi),nlo=sz(lo);
vi toh(nhi);
{
int j=nlo-1;
rep(i,nhi){
while(j>=0 and ccw(hi[i],a[pivot],lo[j])>=0){
j-=1;
}
toh[i]=j;
}
}
vi tol(nlo);
{
int j=nhi-1;
per(i,nlo){
while(j>=0 and ccw(lo[i],a[pivot],hi[j])>=0){
j-=1;
}
tol[i]=j;
}
}
// rep(i,nhi){
// print(hi[i].x,hi[i].y);
// }
rep(i,nlo){
ans-=mint(2).pow(nlo-i+nhi-(tol[i]+1)-1);
// print(toh[i]);
}
rep(i,nhi){
ans-=mint(2).pow(nhi-i+nlo-(toh[i]+1)-1);
// print(nhi-i);
}
ans-=1;
};
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... |