QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#772337#9576. Ordainer of Inexorable JudgmentlaonongminWA 1ms4132kbC++232.3kb2024-11-22 18:51:072024-11-22 18:51:07

Judging History

你现在查看的是最新测评结果

  • [2024-12-23 14:23:26]
  • hack成功,自动添加数据
  • (/hack/1303)
  • [2024-12-06 11:32:56]
  • hack成功,自动添加数据
  • (/hack/1271)
  • [2024-11-22 18:51:07]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:4132kb
  • [2024-11-22 18:51:07]
  • 提交

answer

#pragma GCC optimize(3)
#include <bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
#define N 105
#define double long double
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)
{
    if(sgn(r1-l1)==-1 || sgn(r2-l2)==-1) return 0;
    return max((double)0, (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((mx2-mi2) - (mx1-mi1)) != -1)
    {
        double ans = cnt*(mx1-mi1);
        ans += qjj(mi1,mx1,cur1,cur1+t) + qjj(mi1,mx1,0,cur1+t-2*PI);
        cout<<ans<<'\n';
    }
    else
    {
        double ans = cnt*(mx2-mi2);
        ans += qjj(mi2,mx2,cur2,cur2+t) + qjj(mi2,mx2,-PI,cur2+t-2*PI);
        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: 4004kb

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

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

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

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: -100
Wrong Answer
time: 0ms
memory: 4132kb

input:

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

output:

7500.077645905922

result:

wrong answer 1st numbers differ - expected: '2500.2406700', found: '7500.0776459', error = '1.9997423'