QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#834516 | #9253. Prism Palace | asafox | WA | 23ms | 11192kb | C++14 | 894b | 2024-12-27 19:44:10 | 2024-12-27 19:44:11 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
int n;
const int maxn=1e6+10;
const long double pi=acos(-1);
pair<int,int>a[maxn],v[maxn];
long double work(int x,int y){
long double xa=v[x].first;
long double ya=v[x].second;
long double xb=v[y].first;
long double yb=v[y].second;
long double sn=(xa*yb-ya*xb)/(sqrt(xa*xa+ya*ya)*sqrt(xb*xb+yb*yb));
if(sn>1.0L) sn=1.0L;
if(sn<-1.0L) sn=-1.0L;
long double sita=asin(sn);
if(sita>0) sita=0;
return -sita;
}
long double ans=0;
int main(){
scanf("%d",&n);
for(int i=1;i<=n;i++){
scanf("%d%d",&a[i].first,&a[i].second);
}
a[n+1]=a[1];
a[0]=a[n];
for(int i=1;i<=n;i++){
v[i].first=a[i+1].first-a[i].first;
v[i].second=a[i+1].second-a[i].second;
}
for(int i=1;i<=n-2;i++){
ans+=work(i,i+2);
}
ans+=work(n-1,1);
ans+=work(n,2);
// cout<<ans<<endl;
printf("%.9Lf",ans/pi);
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 6060kb
input:
3 0 0 1 0 0 1
output:
1.000000000
result:
ok found '1.0000000', expected '1.0000000', error '0.0000000'
Test #2:
score: 0
Accepted
time: 1ms
memory: 5964kb
input:
4 0 0 0 1 1 1 1 0
output:
0.000000000
result:
ok found '0.0000000', expected '0.0000000', error '-0.0000000'
Test #3:
score: 0
Accepted
time: 1ms
memory: 5968kb
input:
4 0 0 0 3 1 2 1 1
output:
0.500000000
result:
ok found '0.5000000', expected '0.5000000', error '0.0000000'
Test #4:
score: -100
Wrong Answer
time: 23ms
memory: 11192kb
input:
199996 719157942 80035870 719158808 80033199 719160795 80027070 719162868 80020675 719165635 80012139 719166422 80009711 719166927 80008153 719168388 80003645 719168539 80003179 719168806 80002355 719168864 80002176 719169119 80001389 719171067 79995376 719173806 79986921 719175195 79982633 71917686...
output:
2.997766053
result:
wrong answer 1st numbers differ - expected: '0.0000777', found: '2.9977661', error = '2.9976883'