Submission #2130108
Source Code Expand
#include"bits/stdc++.h"
#define PB push_back
#define PF push_front
#define LB lower_bound
#define UB upper_bound
#define fr(x) freopen(x,"r",stdin)
#define fw(x) freopen(x,"w",stdout)
#define iout(x) printf("%d\n",x)
#define lout(x) printf("%lld\n",x)
#define REP(x,l,u) for(int x = (l);x<=(u);x++)
#define RREP(x,l,u) for(int x = (l);x>=(u);x--)
#define mst(x,a) memset(x,a,sizeof(x))
#define PII pair<int,int>
#define PLL pair<ll,ll>
#define MP make_pair
#define se second
#define fi first
#define dbg(x) cout<<#x<<" = "<<(x)<<endl;
#define sz(x) ((int)x.size())
#define cl(x) x.clear()
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef double ld;
using namespace std;
const int maxn = 200010;
const int mod = 1e9+7;
const int MAX = 1000000010;
const double eps = 1e-6;
const double PI = acos(-1);
template<typename T> inline void read(T &x){
x=0;T f=1;char ch;do{ch=getchar();if(ch=='-')f=-1;}while(ch<'0'||ch>'9');do x=x*10+ch-'0',ch=getchar();while(ch<='9'&&ch>='0');x*=f;
}
template<typename A,typename B> inline void read(A&x,B&y){read(x);read(y);}
template<typename A,typename B,typename C> inline void read(A&x,B&y,C&z){read(x);read(y);read(z);}
template<typename A,typename B,typename C,typename D> inline void read(A&x,B&y,C&z,D&w){read(x);read(y);read(z);read(w);}
template<typename A,typename B> inline A fexp(A x,B p){A ans=1;for(;p;p>>=1,x=1LL*x*x%mod)if(p&1)ans=1LL*ans*x%mod;return ans;}
template<typename A,typename B> inline A fexp(A x,B p,A mo){A ans=1;for(;p;p>>=1,x=1LL*x*x%mo)if(p&1)ans=1LL*ans*x%mo;return ans;}
int n;
int x[maxn],y[maxn];
ld fix(ld x){
if(x<0)x+=PI*2;
if(x>PI*2)x-=PI*2;
return x;
}
int vi[maxn];
ld hs[maxn];int cnt;
void Work(){
REP(i,1,n){
cnt=0;
REP(j,1,n)if(i!=j){
ld _x=fix(atan2(y[j]-y[i],x[j]-x[i]));
_x=fix(_x+PI/2);
ld y=fix(_x+PI);
hs[++cnt]=_x;hs[++cnt]=y;
}
sort(hs+1,hs+cnt+1);cnt=unique(hs+1,hs+cnt+1)-hs-1;
REP(j,1,cnt)vi[j]=0;
// REP(j,1,cnt)cout<<hs[j]<<' ';cout<<endl;
REP(j,1,n)if(i!=j){
ld _x=fix(atan2(y[j]-y[i],x[j]-x[i]));
_x=fix(_x+PI/2);
ld y=fix(_x+PI);
int xx=LB(hs+1,hs+cnt+1,_x)-hs;
int yy=LB(hs+1,hs+cnt+1,y)-hs;
while(xx!=yy){
vi[xx]=1;
xx++;if(xx>cnt)xx=1;
}
}
double ans=0;
REP(j,1,cnt)if(!vi[j])if(j==cnt)ans+=fix(hs[1]-hs[j]);else ans+=fix(hs[j+1]-hs[j]);
printf("%.15lf\n",ans/PI/2);
}
}
void Init(){
read(n);
REP(i,1,n)read(x[i],y[i]);
}
int main(){
Init();
Work();
return 0;
}
Submission Info
| Submission Time |
|
| Task |
B - Holes |
| User |
yanQval |
| Language |
C++14 (GCC 5.4.1) |
| Score |
600 |
| Code Size |
2574 Byte |
| Status |
AC |
| Exec Time |
9 ms |
| Memory |
512 KiB |
Judge Result
| Set Name |
Sample |
All |
| Score / Max Score |
0 / 0 |
600 / 600 |
| Status |
|
|
| Set Name |
Test Cases |
| Sample |
s1.txt, s2.txt |
| All |
01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, 20.txt, 21.txt, 22.txt, 23.txt, 24.txt, s1.txt, s2.txt |
| Case Name |
Status |
Exec Time |
Memory |
| 01.txt |
AC |
9 ms |
512 KiB |
| 02.txt |
AC |
5 ms |
256 KiB |
| 03.txt |
AC |
6 ms |
256 KiB |
| 04.txt |
AC |
5 ms |
256 KiB |
| 05.txt |
AC |
5 ms |
256 KiB |
| 06.txt |
AC |
5 ms |
256 KiB |
| 07.txt |
AC |
5 ms |
256 KiB |
| 08.txt |
AC |
5 ms |
256 KiB |
| 09.txt |
AC |
5 ms |
256 KiB |
| 10.txt |
AC |
5 ms |
256 KiB |
| 11.txt |
AC |
2 ms |
256 KiB |
| 12.txt |
AC |
2 ms |
256 KiB |
| 13.txt |
AC |
5 ms |
256 KiB |
| 14.txt |
AC |
5 ms |
256 KiB |
| 15.txt |
AC |
5 ms |
256 KiB |
| 16.txt |
AC |
5 ms |
256 KiB |
| 17.txt |
AC |
5 ms |
256 KiB |
| 18.txt |
AC |
5 ms |
256 KiB |
| 19.txt |
AC |
2 ms |
256 KiB |
| 20.txt |
AC |
2 ms |
256 KiB |
| 21.txt |
AC |
1 ms |
256 KiB |
| 22.txt |
AC |
1 ms |
256 KiB |
| 23.txt |
AC |
1 ms |
256 KiB |
| 24.txt |
AC |
1 ms |
256 KiB |
| s1.txt |
AC |
1 ms |
256 KiB |
| s2.txt |
AC |
1 ms |
256 KiB |