QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#722725 | #9576. Ordainer of Inexorable Judgment | Mu_Silk | WA | 0ms | 4300kb | C++23 | 2.0kb | 2024-11-07 20:02:51 | 2024-11-07 20:02:51 |
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-07 20:02:51]
- 提交
answer
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const double eps=1e-6;
int sgn(double x){
if(x>eps)return 1;
if(x<-eps)return -1;
return 0;
}
struct vec{
double x,y;
vec operator-(vec a){return {x-a.x,y-a.y};}
vec operator-(){return {-x,-y};}
double len(){return hypot(x,y);}
vec rot90(){return {-y,x};}
vec rotate(double c){
return {x*cos(c)-y*sin(c),x*sin(c)+y*cos(c)};
}
};
double cross(vec a,vec b){
return a.x*b.y-a.y*b.x;
}
struct cir{
vec o{0,0};
double r;
};
int getTangents(vec p,cir c,vec& v0,vec& v1){
vec u=c.o-p;
double dist=u.len();
if(sgn(dist-c.r)<0)return 0;
if(!sgn(dist-c.r)){
v0=u.rot90();
return 1;
}
double ang=asin(c.r/dist);
v0=u.rotate(-ang);
v1=u.rotate(ang);
return 2;
}
const double pi=acos(-1);
void solve(){
int n;
vec d;
cir c;c.o={0,0};
double t;
cin>>n>>d.x>>d.y>>c.r>>t;
double a=atan2(d.y,d.x);
vector<vec> v(n);
for(int i=0;i<n;i++){
cin>>v[i].x>>v[i].y;
v[i].rotate(-a);
}
vec l0,r0;
for(int i=0;i<n;i++){
vec l,r;
getTangents(v[i],c,l,r);
l=-l;r=-r;
if(i==0)l0=l,r0=r;
else{
if(sgn(cross(l,l0))>=0)l0=l;
if(sgn(cross(r0,r))>=0)r0=r;
}
// cout<<atan2(l.y,l.x)<<" "<<atan2(r.y,r.x)<<"\n";
}
double al=atan2(l0.y,l0.x);
double ar=atan2(r0.y,r0.x);
a=ar-al;if(sgn(a)<0)a+=2*pi;
double cnt=floor(t/(2*pi));
double ans=cnt*a;
t-=cnt*(2*pi);
if(ar>=al){
if(t>al);
ans+=min(t-al,ar-al);
}
else{
ans+=min(t,ar);
if(t>al)ans+=t-al;
}
// cout<<atan2(l0.y,l0.x)<<" "<<atan2(r0.y,r0.x)<<"\n";
cout<<fixed<<setprecision(12)<<ans<<"\n";
}
int main(){
ios::sync_with_stdio(0);
cin.tie(0);cout.tie(0);
int n=1;
//cin>>n;
while(n--)solve();
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 4208kb
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: 0ms
memory: 4212kb
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: 4300kb
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: -100
Wrong Answer
time: 0ms
memory: 4260kb
input:
3 10000 10000 1 10000 10000 9999 10000 10000 9999 10000
output:
0.384362017004
result:
wrong answer 1st numbers differ - expected: '0.3842413', found: '0.3843620', error = '0.0001207'