QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#725179 | #9576. Ordainer of Inexorable Judgment | ucup-team1338# | WA | 8ms | 27452kb | C++17 | 1.8kb | 2024-11-08 16:34:45 | 2024-11-08 16:34:45 |
Judging History
你现在查看的是最新测评结果
- [2024-12-23 14:23:26]
- hack成功,自动添加数据
- (/hack/1303)
- [2024-12-06 11:32:56]
- hack成功,自动添加数据
- (/hack/1271)
- [2024-11-14 21:58:28]
- hack成功,自动添加数据
- (/hack/1181)
- [2024-11-08 16:34:45]
- 提交
answer
#include<bits/stdc++.h>
using namespace std;
const long double pi=acosl(-1.0);
struct point{
long double x,y,rd;
void in(){scanf("%Lf %Lf",&x,&y);}
void out(){printf("%Lf %Lf\n",x,y);}
point(long double xx=0,long double yy=0){x=xx,y=yy;}
point operator + (const point& a)const{return point(x+a.x,y+a.y);}
point operator - (const point& a)const{return point(x-a.x,y-a.y);}
long double operator *(const point& a)const{return x*a.x+y*a.y;}
long double operator ^(const point& a)const{return x*a.y-y*a.x;}
bool operator < (const point& a)const{return rd<a.rd;}
};
long double len(const point& a){return sqrtl(a*a);}
long double rad(const point& a){return atan2l(a.y,a.x);}
const int maxn=500013;
point p[maxn];
long double cal(long double t,long double l,long double r){
long double w=(r-l);
if(w<=0) w+=pi+pi;
long double ans=0;
while(t>=pi+pi)t-=pi+pi,ans+=w;
if(l<r)return ans+max(0.0l,min(t,r)-l);
return ans+max(t-l,0.0l)+min(t,r);
}
int main(){
int n;point s;long double d,t;
scanf("%d",&n);s.in();
scanf("%Lf %Lf",&d,&t);
for(int i=1;i<=n;i++) p[i].in();
for(int i=1;i<=n;i++) p[i].rd=rad(p[i]);
sort(p+1,p+1+n);
long double l,r;
if(p[n].rd-p[1].rd<pi){
long double dl=asinl(d/len(p[1]));
long double dr=asinl(d/len(p[n]));
l=p[1].rd-dl;
r=p[n].rd+dr;
}
else{
int pos1=n;
while(p[pos1].rd-p[pos1-1].rd<pi) pos1--;
int pos2=pos1-1;
long double dl=asinl(d/len(p[pos1])),dr=asinl(d/len(p[pos2]));
l=p[pos1].rd-dl;
r=p[pos2].rd+dr;
}
if(l>=2*pi) l-=2*pi;
if(r>=2*pi) r-=2*pi;
if(l<0) l+=2*pi;
if(r<0) r+=2*pi;
printf("%.15Lf\n",cal(rad(s)+t,l,r)-cal(rad(s),l,r));
}
详细
Test #1:
score: 100
Accepted
time: 3ms
memory: 27336kb
input:
3 1 0 1 1 1 2 2 1 2 2
output:
1.000000000000000
result:
ok found '1.0000000', expected '1.0000000', error '0.0000000'
Test #2:
score: 0
Accepted
time: 8ms
memory: 27432kb
input:
3 1 0 1 2 1 2 2 1 2 2
output:
1.570796326794897
result:
ok found '1.5707963', expected '1.5707963', error '0.0000000'
Test #3:
score: 0
Accepted
time: 3ms
memory: 27400kb
input:
3 1 0 1 10000 1 2 2 1 2 2
output:
2500.707752257475429
result:
ok found '2500.7077523', expected '2500.7077523', error '0.0000000'
Test #4:
score: 0
Accepted
time: 0ms
memory: 27452kb
input:
3 10000 10000 1 10000 10000 9999 10000 10000 9999 10000
output:
0.384241300290265
result:
ok found '0.3842413', expected '0.3842413', error '0.0000000'
Test #5:
score: -100
Wrong Answer
time: 0ms
memory: 27396kb
input:
3 -10000 -10000 10000 10000 -10000 -9999 -10000 -10000 -9999 -10000
output:
2499.455171841210880
result:
wrong answer 1st numbers differ - expected: '2500.2406700', found: '2499.4551718', error = '0.0003142'