QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#718936#9576. Ordainer of Inexorable Judgmentucup-team1196Compile Error//C++232.6kb2024-11-06 21:51:062024-11-06 21:51:06

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-06 21:51:06]
  • 评测
  • [2024-11-06 21:51:06]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;

using ll=long long;
#define endl '\n'
#define pi 3.141592653589793238462643383279502884

struct point{
    double x,y;
}p[101],C;
struct vec{
    double x,y;
    double length()
    {
        return sqrt(x*x+y*y);
    }
};
double dot(vec a,vec b)
{
    return a.x*b.x+a.y*b.y;
}
double cross(vec a,vec b)
{
    return a.x*b.y-a.y*b.x;
}
vec pointvec(point A,point B)
{
    vec a;
    a.x=B.x-A.x;
    a.y=B.y-A.y;
    return a;
}

ll n;
double d,t,tmax,tmin,ans,k,tmid,deg,res[201];

void solve(point cur,int id)
{
    vec a,b;
    a=pointvec(C,p[0]);
    b=pointvec(C,cur);
    
    deg=asin(d/b.length());
    tmid=asin(cross(a,b)/(a.length()*b.length()));
    
    if(dot(a,b)<=0)
    {
        if(cross(a,b)>0&&dot(a,b)<0)
        {
            tmid=pi-tmid;
        }
        if(cross(a,b)<0&&dot(a,b)<=0)
        {
            tmid=-pi-tmid;
        }
    }
    if(cross(a,b)<0)
    {
        tmid+=(2.0*pi);
    }
    if(cross(a,b)==0)
    {
        if((a.x==-b.x&&a.x!=0)||(a.y==-b.y&&a.y!=0))
        {
            tmid+=pi;
        }
    }
    
    res[(id<<1)-1]=tmid+deg;
    res[(id<<1)]=tmid-deg;
    
    return;
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    
    cout<<fixed<<setprecision(20);
    
    C.x=0;
    C.y=0;
    
    cin>>n>>p[0].x>>p[0].y>>d>>t;
    for(int i=1;i<=n;i++)
    {
        cin>>p[i].x>>p[i].y;
    }
    
    for(int i=1;i<=n;i++)
    {
        solve(p[i],i);
    }
    
    tmax=-100;
    tmin=100;
    for(int i=1;i<=(n<<1);i++)
    {
        if(i>1)
        {
            if(res[i]-res[1]>=pi)
            {
                res[i]-=(2.0*pi);
            }
            if(res[1]-res[i]>=pi)
            {
                res[i]+=(2.0*pi);
            }
        }
        tmax=max(tmax,res[i]);
        tmin=min(tmin,res[i]);
    }
    
    if(tmax<=0.0)
    {
        tmax+=(2.0*pi);
        tmin+=(2.0*pi);
    }
    if(tmax>2.0*pi)
    {
        tmax-=(2.0*pi);
        tmin-=(2.0*pi);
    }
    
    k=(ll)(t/pi/2.0);
    ans=k*(tmax-tmin)+max(0.0,min(t,k*2.0*pi+tmax)-max(k*2.0*pi,k*2.0*pi+tmin));
    
    if(tmin<0.0)
    {
        ans+=max(0.0,t-((k+1)*2.0*pi+tmin));
    }
//    cout<<tmax-tmin<<endl;
    cout<<ans;
    
    return 0;
}
/*
19 -1886 -3232 561 6
-8846 -7186
-8842 -7658
-8705 -7660
-1521 -7660
-1248 -7658
-1048 -7654
-906 -7650
-877 -7643
-858 -7619
-846 -7598
-846 -1489
-847 -277
-851 311
-1001 332
-1072 340
-7480 340
-8844 337
-8845 332
-8846 -9
*

Details

answer.code:139:1: error: unterminated comment
  139 | /*
      | ^