QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#723332 | #9576. Ordainer of Inexorable Judgment | ucup-team5217 | WA | 0ms | 4268kb | C++23 | 2.6kb | 2024-11-07 21:51:21 | 2024-11-07 21:51:21 |
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:51:21]
- 提交
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);
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{
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())){
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=min(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)));
}
}
const ld PI=acos(-1);
if(res.first<0) res.first+=2*PI;
if(res.second<0) res.second+=2*PI;
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: 4244kb
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: 4268kb
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: 4200kb
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: -100
Wrong Answer
time: 0ms
memory: 4180kb
input:
3 10000 10000 1 10000 10000 9999 10000 10000 9999 10000
output:
1249.76065897
result:
wrong answer 1st numbers differ - expected: '0.3842413', found: '1249.7606590', error = '1249.3764177'