QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#725320#9576. Ordainer of Inexorable Judgmentucup-team1338#WA 1ms4332kbC++171.8kb2024-11-08 17:06:402024-11-08 17:06:40

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

answer

#include<bits/stdc++.h>
using namespace std;
const double pi=acos(-1.0);
struct point{
    double x,y,rd;
    void in(){scanf("%lf %lf",&x,&y);}
    void out(){printf("%lf %lf\n",x,y);}
    point(double xx=0,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);}
    double operator *(const point& a)const{return x*a.x+y*a.y;}
    double operator ^(const point& a)const{return x*a.y-y*a.x;}
    bool operator < (const point& a)const{return rd<a.rd;}
};
double len(const point& a){return sqrt(a*a);}
double rad(const point& a){return atan2(a.y,a.x);}
const int maxn=105;
point p[maxn];
double cal(double t,double l,double r)
{
    double w=(r-l);
    if(w<0) w+=2*pi;
    double ans=(int)(t/(2*pi))*w;
    t-=(int)(t/(2*pi))*2.0*pi;
    if(l<r)
    {
        return ans+max(0.0,min(t,r)-l);
    }
    else
    {
        return ans+max(t-l,0.0)+min(t,r);
    }
}
typedef double ld;
int main(){
    //printf("%lf",asin(1/sqrt(5)));
    int n;point s;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]);
    ld v=rad(s);
    sort(p+1,p+1+n);
    double l=pi+pi,r=0;
    for(int i=1;i<=n;i++)l=min(l,p[i].rd),r=max(r,p[i].rd);
    while(p[n].rd-p[1].rd>=pi){
        ld d=pi+pi-p[n].rd;
        for(int i=1;i<=n;i++)p[i].rd+=d;
        v+=d;
        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++){
        double di=asin(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: 1ms
memory: 4200kb

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

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

input:

3 1 0 1 10000
1 2
2 1
2 2

output:

2500.707752257475477

result:

ok found '2500.7077523', expected '2500.7077523', error '0.0000000'

Test #4:

score: 0
Accepted
time: 0ms
memory: 4280kb

input:

3 10000 10000 1 10000
10000 9999
10000 10000
9999 10000

output:

0.384241300290388

result:

ok found '0.3842413', expected '0.3842413', error '0.0000000'

Test #5:

score: -100
Wrong Answer
time: 0ms
memory: 4204kb

input:

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

output:

5000.789214306819304

result:

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