QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#768046 | #9576. Ordainer of Inexorable Judgment | tz3528 | WA | 0ms | 4028kb | C++23 | 1.4kb | 2024-11-20 23:56:14 | 2024-11-20 23:56:14 |
Judging History
你现在查看的是最新测评结果
- [2024-12-23 14:23:26]
- hack成功,自动添加数据
- (/hack/1303)
- [2024-12-06 11:32:56]
- hack成功,自动添加数据
- (/hack/1271)
- [2024-11-20 23:56:14]
- 提交
answer
#include<bits/stdc++.h>
using namespace std;
const long double pi=acos(-1);
struct point {
long double x,y;
};
long double dist(point u,point v){
return sqrt((u.x-v.x)*(u.x-v.y)+(u.y-v.y)*(u.y-v.y));
}
int n,d,t;
int main(){
point o;
cin>>n>>o.x>>o.y>>d>>t;
point a[n+10];
for(int i=1;i<=n;i++){
cin>>a[i].x>>a[i].y;
}
long double start=atan2(o.y,o.x);
if(start<0) start+=pi;
vector<long double>b,c;
for(int i=1;i<=n;i++){
long double ang=atan2(a[i].y,a[i].x);
if(ang<0) ang+=2*pi;
long double now=atan2(d,sqrt(dist(a[i],{0,0})*dist(a[i],{0,0})-d*d));
if(ang+now<2*pi) b.push_back(ang+now);
else b.push_back(ang+now-2*pi);
if(ang-now>=0.0) c.push_back(ang-now);
else c.push_back(ang-now+2*pi);
}
sort(b.begin(),b.end());
sort(c.begin(),c.end());
for(int i=1;i<n;i++){
if(b[i]-b[i-1]>pi){
for(int j=0;j<i;j++){
b[j]+=pi;
}
break;
}
}
for(int i=1;i<n;i++){
if(c[i]-c[i-1]>pi){
for(int j=0;j<i;j++){
c[j]+=pi;
}
break;
}
}
long double l=c[0],r=b[n-1];
if(l>r) r+=2*pi;
if(r>2*pi) l-=2*pi,r-=2*pi;
auto f=[&](long double now)->long double{
long long k=now/(2*pi);
long double ans=(r-l)*k;
now-=pi*2*k;
if(now>r) ans+=r-max((long double)0.0,l);
if(now<=r&&now>=max((long double)0.0,l)) ans+=now-max((long double)0.0,l);
return ans;
};
printf("%.10Lf\n",f(start+t)-f(start));
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 4028kb
input:
3 1 0 1 1 1 2 2 1 2 2
output:
1.0000000000
result:
ok found '1.0000000', expected '1.0000000', error '0.0000000'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3920kb
input:
3 1 0 1 2 1 2 2 1 2 2
output:
1.5707963268
result:
ok found '1.5707963', expected '1.5707963', error '0.0000000'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3892kb
input:
3 1 0 1 10000 1 2 2 1 2 2
output:
2500.7077522575
result:
ok found '2500.7077523', expected '2500.7077523', error '0.0000000'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3820kb
input:
3 10000 10000 1 10000 10000 9999 10000 10000 9999 10000
output:
0.3842413003
result:
ok found '0.3842413', expected '0.3842413', error '0.0000000'
Test #5:
score: -100
Wrong Answer
time: 0ms
memory: 3912kb
input:
3 -10000 -10000 10000 10000 -10000 -9999 -10000 -10000 -9999 -10000
output:
2500.5512536333
result:
wrong answer 1st numbers differ - expected: '2500.2406700', found: '2500.5512536', error = '0.0001242'