QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#884231#9576. Ordainer of Inexorable JudgmentwangjinboWA 1ms4096kbC++202.4kb2025-02-05 22:30:532025-02-05 22:30:54

Judging History

This is the latest submission verdict.

  • [2025-02-05 22:30:54]
  • Judged
  • Verdict: WA
  • Time: 1ms
  • Memory: 4096kb
  • [2025-02-05 22:30:53]
  • Submitted

answer

#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<cstdlib>
#include<set>
#include<vector>
#include<map>
#include<queue>
#include<stack>
#define y0 M_y0
using namespace std;
typedef long long ll;
const int N=105,M=5e6+10;
const double PI=acos(-1);
int n,x0,y0,d,t;
int x[N],y[N],num;
struct node{
    double x;
    int op;
}a[M];
bool operator < (node x,node y){
    return x.x<y.x;
}
double mx=0.0,mn=1e18;
void add(double l,double r){
    mx=max(mx,r);mn=min(mn,l);
    a[++num]=(node){l,1};
    a[++num]=(node){r,-1};
}
void solve(double tx,double ty){
    double ang=atan2(ty,tx);if(ang<0)ang+=2*PI;
    if(d>=sqrt(tx*tx+ty*ty)){
        add(0,2*PI);
        return;
    }
    double del=asin((double)d/sqrt(tx*tx+ty*ty));
    double tl=ang-del,tr=ang+del;
    if(tl<0){
        add(0,tr);add(tl+2*PI,2*PI);
    }
    else if(tr>2*PI){
        add(0,tr-2*PI);add(tl,2*PI);
    }
    else{
        add(tl,tr);
    }
}
inline ll read(){
    ll x=0,w=1;char c=getchar();
    while(c<'0'||c>'9'){if(c=='-')w=-1;c=getchar();}
    while('0'<=c&&c<='9')x=x*10+c-'0',c=getchar();
    return x*w;
}
int main(){
    n=read();x0=read();y0=read();d=read();t=read();
    for(int i=1;i<=n;i++)x[i]=read(),y[i]=read();
    x[n+1]=x[1];y[n+1]=y[1];
    for(int i=1;i<=n;i++){
        solve(x[i],y[i]);
        /*if(x[i]==x[i+1]){
            for(double ty=min(y[i],y[i+1])+1;ty<max(y[i],y[i+1]);ty++)solve(x[i],ty);
        }
        else{
            double k=(y[i+1]-y[i])/(x[i+1]-x[i]);
            for(int tx=min(x[i],x[i+1])+1;tx<max(x[i],x[i+1]);tx++){
                double ty=y[i]+k*(tx-x[i]);solve(tx,ty);
            }
        }*/
    }
    double ans=0.0;
    int cnt=0;
    double a0=atan2(y0,x0);if(a0<0)a0+=2*PI;
    int w=t/(2*PI);double ls=t-2*PI*w;
    a[++num]=(node){a0,0};
    if(a0+ls>2*PI)a[++num]=(node){a0+ls-2*PI,0};
    else a[++num]=(node){a0+ls,0};
    sort(a+1,a+1+num);
    for(int i=1;i<=num;i++){
        if(cnt>0&&i>1){
            int cw=w;
            double cx=(a[i].x+a[i-1].x)/2.0;
            if(a0+ls<=2*PI){
                if(a0<=cx&&cx<=a0+ls)cw++;
            }
            else{
                if(cx>=a0||cx<=a0+ls-2*PI)cw++;
            }
            ans+=cw*(a[i].x-a[i-1].x);
        }
        cnt+=a[i].op;
    }
    printf("%.12f\n",ans);
    //cout<<mx-mn<<endl;
    return 0;
}

详细

Test #1:

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

input:

3 1 0 1 1
1 2
2 1
2 2

output:

1.000000000000

result:

ok found '1.0000000', expected '1.0000000', error '0.0000000'

Test #2:

score: 0
Accepted
time: 1ms
memory: 3968kb

input:

3 1 0 1 2
1 2
2 1
2 2

output:

1.570796326795

result:

ok found '1.5707963', expected '1.5707963', error '0.0000000'

Test #3:

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

input:

3 1 0 1 10000
1 2
2 1
2 2

output:

2500.707752257475

result:

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

Test #4:

score: 0
Accepted
time: 1ms
memory: 3968kb

input:

3 10000 10000 1 10000
10000 9999
10000 10000
9999 10000

output:

0.384241300290

result:

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

Test #5:

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

input:

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

output:

2500.240670009608

result:

ok found '2500.2406700', expected '2500.2406700', error '0.0000000'

Test #6:

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

input:

4 1 0 1 10000
-2 3400
-4 10000
-4 -10000
-2 -3400

output:

1.872352644235

result:

wrong answer 1st numbers differ - expected: '4999.2191154', found: '1.8723526', error = '0.9996255'