QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#551656 | #9253. Prism Palace | ucup-team4770# | WA | 17ms | 10652kb | C++14 | 1.5kb | 2024-09-07 17:39:14 | 2024-09-07 17:39:17 |
Judging History
answer
//Date: 2024-09-07 16:47:13
#include<bits/stdc++.h>
using namespace std;
#define int long long
inline int rd() {
int s=0,m=0;char ch=getchar();
while(!isdigit(ch)) {if(ch=='-')m=1;ch=getchar();}
while( isdigit(ch)) s=(s<<3)+(s<<1)+(ch^48),ch=getchar();
return m?-s:s;
}
bool MBE;
namespace SOLVER {
const double pi=acos(-1);
int n,x[200005],y[200005];double a[200005],b[200005],ans;
void MAIN() {
cin>>n;for(int i=0;i<n;i++) x[i]=rd(),y[i]=rd();x[n]=x[0],y[n]=y[0];
for(int i=0;i<n;i++) a[i]=atan2(y[i+1]-y[i],x[i+1]-x[i]);a[n]=a[0];
if(a[0]-atan2(y[n-1]-y[0],x[n-1]-x[0])<0) {//逆时针
for(int i=0;i<n;i++) {
b[i]=a[(i+n-1)%n]-a[i];
while(b[i]<=0) b[i]+=pi;
while(b[i]>pi) b[i]-=pi;
// printf("%.12lf\n",b[i]);
}
for(int i=0;i<n;i++) ans+=max(0.0,pi-b[(i+n-1)%n]-b[i]);
printf("%.12lf\n",ans/pi);
}
else {//顺时针
for(int i=0;i<n;i++) {
b[i]=a[i]-a[(i+n-1)%n];
while(b[i]<=0) b[i]+=pi;
while(b[i]>pi) b[i]-=pi;
// printf("%.12lf\n",b[i]);
}
for(int i=0;i<n;i++) ans+=max(0.0,pi-b[(i+n-1)%n]-b[i]);
printf("%.12lf\n",ans/pi);
}
}
}
bool MED;
signed main() {
//freopen(".in","r",stdin);freopen(".out","w",stdout);
for(int tt=1;tt;tt--) SOLVER::MAIN();
cerr<<(&MBE-&MED)/1024<<" KB, "<<1000*clock()/CLOCKS_PER_SEC<<" ms\n";
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 8504kb
input:
3 0 0 1 0 0 1
output:
1.000000000000
result:
ok found '1.0000000', expected '1.0000000', error '0.0000000'
Test #2:
score: 0
Accepted
time: 1ms
memory: 8308kb
input:
4 0 0 0 1 1 1 1 0
output:
0.000000000000
result:
ok found '0.0000000', expected '0.0000000', error '-0.0000000'
Test #3:
score: 0
Accepted
time: 1ms
memory: 8432kb
input:
4 0 0 0 3 1 2 1 1
output:
0.500000000000
result:
ok found '0.5000000', expected '0.5000000', error '0.0000000'
Test #4:
score: -100
Wrong Answer
time: 17ms
memory: 10652kb
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:
199992.000077717908
result:
wrong answer 1st numbers differ - expected: '0.0000777', found: '199992.0000777', error = '199992.0000000'