QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#772323 | #9576. Ordainer of Inexorable Judgment | laonongmin | WA | 0ms | 4416kb | C++23 | 2.1kb | 2024-11-22 18:42:16 | 2024-11-22 18:42:19 |
Judging History
你现在查看的是最新测评结果
- [2024-12-23 14:23:26]
- hack成功,自动添加数据
- (/hack/1303)
- [2024-12-06 11:32:56]
- hack成功,自动添加数据
- (/hack/1271)
- [2024-11-22 18:42:16]
- 提交
answer
#pragma GCC optimize(3)
#include <bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
#define N 105
using namespace std;
const double PI = acos(-1);
const double eps = 1e-10;
int sgn(double x){return x < -eps ? -1 : (x < eps ? 0 : 1);} // 解决double精度问题
struct Point {
double x, y;
Point(double x=0, double y=0) : x(x), y(y) {}
double operator^ (const Point &B) const { return x * B.y - y * B.x; }
double operator* (const Point &B) const { return x * B.x + y * B.y; }
double sita(int axis = 1)
{
double res = acos(x/sqrt(x*x+y*y));
if(sgn(y) == -1) res = -res;
if(axis == 1) res += 2*PI;
return res;
}
Point Rotate(double b)
{
Point B(sin(b), cos(b));
return Point((*this) ^ B, (*this) * B);
}
};
double len(Point A) {return sqrt(A*A);}
using Vector = Point;
double qjj(double l1,double r1,double l2,double r2)
{
return (r1-l1)+(r2-l2)-(max(r1,r2)-min(l1,l2));
}
void solve()
{
int n,d;
double t;
Point s;
cin>>n>>s.x>>s.y>>d>>t;
double cur1 = s.sita(1), cur2 = s.sita(-1);
double mx1 = -1e9, mi1 = 1e9;
double mx2 = -1e9, mi2 = 1e9;
for(int i=1;i<=n;++i)
{
int x,y; cin>>x>>y;
Point A(x,y);
double tmp = asin(d/len(A));
Point B = A.Rotate(tmp), C = A.Rotate(-tmp);
mx1 = max({mx1, B.sita(1), C.sita(1)});
mi1 = min({mi1, B.sita(1), C.sita(1)});
mx2 = max({mx2, B.sita(-1), C.sita(-1)});
mi2 = min({mi2, B.sita(-1), C.sita(-1)});
}
int cnt = int(t/(2*PI));
t -= cnt*2*PI;
// [cur, cur+t]
if(sgn(PI - (mx1-mi1)) == 1)
{
double ans = cnt*(mx1-mi1);
ans += qjj(mi1,mx1,cur1,cur1+t);
cout<<ans<<'\n';
}
else
{
double ans = cnt*(mx2-mi2);
ans += qjj(mi2,mx2,cur2,cur2+t);
cout<<ans<<'\n';
}
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cout<<fixed<<setprecision(12);
int T=1;
// cin>>T;
while(T--)
{
solve();
}
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 4308kb
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: 4416kb
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: 4164kb
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: 0ms
memory: 4312kb
input:
3 10000 10000 1 10000 10000 9999 10000 10000 9999 10000
output:
0.384241300289
result:
ok found '0.3842413', expected '0.3842413', error '0.0000000'
Test #5:
score: -100
Wrong Answer
time: 0ms
memory: 4408kb
input:
3 -10000 -10000 10000 10000 -10000 -9999 -10000 -10000 -9999 -10000
output:
7500.077645905923
result:
wrong answer 1st numbers differ - expected: '2500.2406700', found: '7500.0776459', error = '1.9997423'