QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#725363#9576. Ordainer of Inexorable Judgmentucup-team1338#WA 1ms4040kbC++171.6kb2024-11-08 17:19:412024-11-08 17:19:42

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 17:19:42]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:4040kb
  • [2024-11-08 17:19:41]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
typedef long double ld;
const ld pi=acos(-1.0l);
struct point{
    ld x,y,rd;
    void in(){scanf("%Lf %Lf",&x,&y);}
    point operator + (const point& a)const{return {x+a.x,y+a.y};}
    point operator - (const point& a)const{return {x-a.x,y-a.y};}
    ld operator *(const point& a)const{return x*a.x+y*a.y;}
    ld operator ^(const point& a)const{return x*a.y-y*a.x;}
    bool operator < (const point& a)const{return rd<a.rd;}
};
ld len(const point& a){return sqrtl(a*a);}
ld rad(const point& a){return atan2l(a.y,a.x);}
const int maxn=105;
point p[maxn];
ld cal(ld t,ld l,ld r){
    ld w=r-l;
    if(w<0) w+=2*pi;
    ld ans=0;
    while(t>pi+pi)t-=pi+pi,ans+=w;
    if(l<r){
        return ans+max(0.0l,min(t,r)-l);
    }
    else{
        return ans+max(t-l,0.0l)+min(t,r);
    }
}
typedef ld ld;
int main(){
    int n;
    point s;
    ld d,t;
    scanf("%d",&n);s.in();scanf("%Lf %Lf",&d,&t);
    for(int i=1;i<=n;i++) p[i].in(),p[i].rd=rad(p[i]);
    ld v=rad(s);
    sort(p+1,p+1+n);
    ld l=pi+pi,r=0;
    while(p[n].rd-p[1].rd+(1e-9)>=pi){
        ld dd=pi+pi-p[n].rd;
        for(int i=1;i<=n;i++)p[i].rd+=dd;
        v+=dd;
        for(int i=1;i<=n;i++)if(p[i].rd+(1e-9)>pi+pi)p[i].rd=0;
        sort(p+1,p+1+n);
    }
    for(int i=1;i<=n;i++)l=min(l,p[i].rd),r=max(r,p[i].rd);
    for(int i=1;i<=n;i++){
        ld di=asinl(d/len(p[i]));
        l=min(l,p[i].rd-di),r=max(r,p[i].rd+di);
    }
    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(v+t,l,r)-cal(v,l,r));
}

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3900kb

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: 0ms
memory: 4020kb

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: 1ms
memory: 4040kb

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: 4036kb

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: 4024kb

input:

3 -10000 -10000 10000 10000
-10000 -9999
-10000 -10000
-9999 -10000

output:

5000.789214306818493

result:

wrong answer 1st numbers differ - expected: '2500.2406700', found: '5000.7892143', error = '1.0001231'