QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#723375#9576. Ordainer of Inexorable Judgmentucup-team5217WA 0ms4280kbC++232.7kb2024-11-07 21:59:122024-11-07 21:59:14

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 21:59:14]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:4280kb
  • [2024-11-07 21:59:12]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
using ld=long double;
 int qx(int x,int y){
    if(x>=0&&y>=0) return 0;
    if(x<0&&y>=0)  return 1;
    if(x<0&&y<0)    return 2;
    if(x>=0&&y<0)   return 3;
}
void solve(void) {
    int n,x,y,d,t;
    cin>>n>>x>>y>>d>>t;
    vector<vector<pair<int,int>>> mp(4);
    const ld PI=acos(-1);
    for(int i=0;i<n;i++){
        int u,v;
        cin>>u>>v;
        mp[qx(u,v)].push_back({u,v});
    }
    pair<ld,ld> res={0,0};
    if((mp[2].size()&&!mp[1].size())||(mp[3].size()&&!mp[2].size())){
        for(auto [x,y]:mp[2]){
            res.first=min(res.first,atan2(y,x)-asin(d/sqrtl(1ll*x*x+1ll*y*y)));
        }
        for(auto [x,y]:mp[3]){
            res.first=min(res.first,atan2(y,x)-asin(d/sqrtl(1ll*x*x+1ll*y*y)));
        }
    }
    else{
        res.first=2*PI;
        for(auto [x,y]:mp[0]){
            res.first=min(res.first,atan2(y,x)-asin(d/sqrtl(1ll*x*x+1ll*y*y)));
        }
        for(auto [x,y]:mp[1]){
            res.first=min(res.first,atan2(y,x)-asin(d/sqrtl(1ll*x*x+1ll*y*y)));
        }
    }
    if((mp[3].size()&&!mp[0].size())||(mp[2].size()&&!mp[3].size())){
        res.second=-2*PI;
        for(auto [x,y]:mp[2]){
            res.second=max(res.second,atan2(y,x)+asin(d/sqrtl(1ll*x*x+1ll*y*y)));
        }
        for(auto [x,y]:mp[3]){
            res.second=max(res.second,atan2(y,x)+asin(d/sqrtl(1ll*x*x+1ll*y*y)));
        }
    }
    else{
        for(auto [x,y]:mp[0]){
            res.second=max(res.second,atan2(y,x)+asin(d/sqrtl(1ll*x*x+1ll*y*y)));
        }
        for(auto [x,y]:mp[1]){
            res.second=max(res.second,atan2(y,x)+asin(d/sqrtl(1ll*x*x+1ll*y*y)));
        }
    }
    if(res.first<0) res.first+=2*PI;
    if(res.second<0) res.second+=2*PI;
    // cerr<<res.first/PI*180<<' '<<res.second/PI*180<<'\n';
    double q=0;
    if(res.second>res.first) q=res.second-res.first;
    else q=res.second-res.first+2*PI;
    ld ans=q*floor(t/(2*PI));
    t=t-floor(t/(2*PI))*(2*PI);
    ld du=atan2(y,x);if(du<0)   du+=2*PI;
    if(res.first>res.second){
        if(du<res.second)   du+=2*PI,res.second+=2*PI;
        else res.second+=2*PI;
    }   
    auto ope=[&](ld st,ld ed)->ld {
        return max(res.first,min(ed,res.second))-res.first;
    };
    if(du<=res.second&&du>=res.first){
        if(du+t<=res.second)    {ans+=t;cout<<setprecision(12)<<ans<<'\n';return ;}
        else {ans+=res.second-du;t-=res.second-du;du=res.second;res.second+=2*PI;res.first+=2*PI;}
    }
    cout<<setprecision(12)<<ans+ope(du,du+t)<<'\n';
    return;
}

int main() {
    ios::sync_with_stdio(false), cin.tie(nullptr);

    int _ = 1;
    while (_--) solve();

    return 0;
}

详细

Test #1:

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

input:

3 1 0 1 1
1 2
2 1
2 2

output:

1

result:

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

Test #2:

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

input:

3 1 0 1 2
1 2
2 1
2 2

output:

1.57079632679

result:

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

Test #3:

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

input:

3 1 0 1 10000
1 2
2 1
2 2

output:

2500.70775226

result:

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

Test #4:

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

input:

3 10000 10000 1 10000
10000 9999
10000 10000
9999 10000

output:

0.38424130029

result:

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

Test #5:

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

input:

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

output:

2500.24067001

result:

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

Test #6:

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

input:

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

output:

4998.76693913

result:

wrong answer 1st numbers differ - expected: '4999.2191154', found: '4998.7669391', error = '0.0000904'