Submission #537299

#TimeUsernameProblemLanguageResultExecution timeMemory
537299inksamuraiKućice (COCI21_kucice)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #define int ll 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); } int sgn(int x){ return (x<0?-1:1); } bool cmpup(P a,P b){ if(sgn(a.x)!=sgn(b)){ return sgn(a.x)<sgn(b.x); } return (a.y*b.x>b.y*a.x) } 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(),cmpup); sort(lo.begin(),lo.end(),cmplo); P pnt(0,0); int nhi=sz(hi),nlo=sz(lo); rep(i,nhi){ int now=nhi-i-1; for(auto p:lo){ if(ccw(hi[i],pnt,p)>=0){ now+=1; } } // for(auto p:hi){ // if(p==hi[i]) continue; // if(ccw(hi[i],pnt,p)>=0){ // now+=1; // } // } ans-=mint(2).pow(now); } per(i,nlo){ int now=i; for(auto p:hi){ if(ccw(lo[i],p,pnt)<0){ // print(lo[i].x,lo[i].y,p.x,p.y); now+=1; } } // for(auto p:lo){ // if(p==lo[i]) continue; // if(ccw(lo[i],p,pnt)<0){ // // print(lo[i].x,lo[i].y,p.x,p.y); // now+=1; // } // } // cout<<now-1<<" "; // break; ans-=mint(2).pow(now); } ans-=1; }; rep(i,n){ quq(i); // break; } ans+=mint(2).pow(n)*n; print(ans.x); // return 0; }

Compilation message (stderr)

Main.cpp: In function 'bool cmpup(P, P)':
Main.cpp:73:19: error: cannot convert 'P' to 'll' {aka 'long long int'}
   73 |  if(sgn(a.x)!=sgn(b)){
      |                   ^
      |                   |
      |                   P
Main.cpp:68:13: note:   initializing argument 1 of 'll sgn(ll)'
   68 | int sgn(int x){
      |             ^
Main.cpp:76:26: error: expected ';' before '}' token
   76 |  return (a.y*b.x>b.y*a.x)
      |                          ^
      |                          ;
   77 | }
      | ~                         
Main.cpp: In lambda function:
Main.cpp:99:28: error: 'cmplo' was not declared in this scope
   99 |   sort(lo.begin(),lo.end(),cmplo);
      |                            ^~~~~