QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#354313 | #5106. Islands from the Sky | Doqe | WA | 1ms | 4268kb | C++20 | 1.5kb | 2024-03-15 08:42:59 | 2024-03-15 08:43:00 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
struct Point
{
int x,y;
Point operator+(const Point&s)const{return {x+s.x,y+s.y};}
Point operator-(const Point&s)const{return {x-s.x,y-s.y};}
};
long long inner(const Point&A,const Point&B)
{
return A.x*B.x+A.y*B.y;
}
long long outer(const Point&A,const Point&B)
{
return A.x*B.y-A.y*B.x;
}
long long abs2(const Point&A){return A.x*A.x+A.y*A.y;}
struct Line{Point A,B;int rA,rB;};
double dis(const Line&L,const Point&O)
{
const Point&A=L.A;
const Point&B=L.B;
int rA=L.rA,rB=L.rB;
// cerr<<"DIS: ["<<A.x<<","<<A.y<<"_"<<rA<<"]~["<<B.x<<","<<B.y<<"_"<<rB<<"] ["<<O.x<<","<<O.y<<"]"<<endl;
if(inner(O-B,A-B)<0||inner(O-A,B-A)<0)return 1e100;
double len=sqrt(abs2(B-A));
assert(len>0);
double dia=abs(outer(O-A,O-B))/len;
double pos=(inner(O-B,A-B))/len;
// assert(pos>=0&&pos<=len);
double h=rB+pos/len*(rA-rB);
// cerr<<" "<<len<<","<<dia<<" "<<pos<<" "<<h<<"->"<<dia/h<<endl;
return dia/h;
}
vector<Point>A[110];
Line B[110];
int n,m;
int main()
{
cin>>n>>m;
for(int i=1;i<=n;++i)
{
int t;cin>>t;
while(t--)
{
int x,y;cin>>x>>y;
A[i].push_back({x,y});
}
}
for(int j=1;j<=m;++j)cin>>B[j].A.x>>B[j].A.y>>B[j].rA>>B[j].B.x>>B[j].B.y>>B[j].rB;
double ans=0;
for(int i=1;i<=n;++i)
{
double mn=1e100,mx;
for(int j=1;j<=m;++j)
{
mx=0;for(auto k:A[i])
mx=max(mx,dis(B[j],k));
mn=min(mn,mx);
}
if(mn>=1e100)return puts("impossible"),0;
ans=max(ans,mn);
}
cerr<<ans<<endl;
printf("%.9lf\n",atan(ans)/acos(-1.0)*180);
}
详细
Test #1:
score: 100
Accepted
time: 1ms
memory: 4204kb
input:
1 1 3 -5 0 5 0 0 5 -10 10 10 10 10 10
output:
45.000000000
result:
ok
Test #2:
score: 0
Accepted
time: 0ms
memory: 4024kb
input:
1 1 3 -5 0 5 0 0 5 -10 0 10 10 0 10
output:
26.565051177
result:
ok
Test #3:
score: 0
Accepted
time: 0ms
memory: 4108kb
input:
1 1 3 -5 0 5 0 0 5 0 10 10 10 0 10
output:
46.686143342
result:
ok
Test #4:
score: 0
Accepted
time: 0ms
memory: 4036kb
input:
1 1 3 -5 0 5 0 0 5 0 10 5 10 0 10
output:
59.491041134
result:
ok
Test #5:
score: 0
Accepted
time: 0ms
memory: 4216kb
input:
1 1 3 -5 0 5 0 0 5 0 10 20 -10 0 10
output:
31.219698447
result:
ok
Test #6:
score: 0
Accepted
time: 1ms
memory: 4268kb
input:
1 3 3 -5 0 5 0 0 5 -10 0 25 10 0 20 -5 10 10 10 -5 20 -4 1 100 5 10 100
output:
12.528807709
result:
ok
Test #7:
score: 0
Accepted
time: 0ms
memory: 4212kb
input:
1 2 4 0 0 20 0 20 40 0 40 -10 30 30 30 30 30 -10 10 30 30 10 30
output:
45.000000000
result:
ok
Test #8:
score: 0
Accepted
time: 0ms
memory: 4152kb
input:
1 4 4 0 0 20 0 20 40 0 40 -10 30 30 30 30 30 -10 20 30 30 20 30 -10 10 30 30 10 30 10 -10 30 10 50 30
output:
18.434948823
result:
ok
Test #9:
score: 0
Accepted
time: 1ms
memory: 3608kb
input:
1 2 4 0 0 40 0 40 40 0 40 10 10 10 20 20 20 30 10 10 10 30 20
output:
impossible
result:
ok
Test #10:
score: 0
Accepted
time: 0ms
memory: 3608kb
input:
1 3 4 0 0 20 0 20 40 0 40 -10 30 30 15 30 30 5 30 30 30 30 30 1 50 30 21 50 30
output:
impossible
result:
ok
Test #11:
score: 0
Accepted
time: 0ms
memory: 4172kb
input:
1 1 4 0 0 40 0 40 40 0 40 -100 -100 20 100 100 10
output:
63.665752153
result:
ok
Test #12:
score: 0
Accepted
time: 0ms
memory: 4160kb
input:
1 4 4 -10 -10 10 -10 10 10 -10 10 -100 0 10 100 0 10 0 100 10 0 -100 10 50 50 15 -50 -50 15 -50 50 15 50 -50 15
output:
43.313856658
result:
ok
Test #13:
score: -100
Wrong Answer
time: 1ms
memory: 3660kb
input:
1 100 100 822286 0 856789 53904 986567 124632 629039 119995 732157 187986 691605 224716 728650 288493 591087 278144 801573 440668 425257 269876 614456 446428 424157 350893 645680 606334 406524 432904 545628 659551 359831 495265 367048 578376 251435 457360 319990 680014 336526 849968 214009 658652 23...
output:
impossible
result:
wrong answer