QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#373111 | #5106. Islands from the Sky | RobeZH# | AC ✓ | 255ms | 4292kb | C++23 | 2.3kb | 2024-04-01 02:37:29 | 2024-04-01 02:37:31 |
Judging History
answer
#pragma GCC optimize("O3,unroll-loops")
// #pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#include<bits/stdc++.h>
// #include<atcoder/all>
#define FR(i,n) for(int i=0;i<n;++i)
#define eb emplace_back
#define st first
#define nd second
#define x1 fxxkcjb
#define y1 fxxkyzc
#define x2 fxxkzzy
#define y2 fxxknitit
using namespace std;
namespace R=ranges;
template<typename T>
using func=function<T>;
template<typename T>
using vec=vector<T>;
using ll=long long;
using ld=long double;
using i128=__int128;
using pii=pair<int,int>;
const ll inf=ll(1e18)+7;
const ld eps=1e-12,PI=acos(-1);
int sgn(ld x){return x<-eps?-1:x>eps;}
struct P{
ld x,y;
P operator+(P p){return {x+p.x,y+p.y};}
P operator-(P p){return {x-p.x,y-p.y};}
P operator*(ld c){return {x*c,y*c};}
ld operator*(P p){return x*p.y-y*p.x;}
ld dis(){return hypot(x,y);}
P rot90(){return {-y,x};}
P norm(){
assert(sgn(dis())>0);
return (*this)*(1/dis());
}
};
struct L3D{
P s,t;
ld zs,zt;
};
void sol(){
int n,m;cin>>n>>m;
vector a(n,vector<P>());
FR(i,n){
int ni;cin>>ni;
a[i].assign(ni,{0,0});
FR(j,ni)cin>>a[i][j].x>>a[i][j].y;
}
vector<L3D>b(m);
for(L3D&l:b){
cin>>l.s.x>>l.s.y>>l.zs;
cin>>l.t.x>>l.t.y>>l.zt;
}
ld l=0,r=4e6;
{
FR(tim,256){
ld mid=(l+r)/2;
vector<int>in(n,0);
for(L3D l:b){
P dir=(l.t-l.s).rot90().norm();
vector<P>poly{l.s+dir*l.zs*mid,l.s-dir*l.zs*mid,l.t-dir*l.zt*mid,l.t+dir*l.zt*mid};
FR(i,n){
if([&](){
for(P p:a[i])
FR(j,4)if(sgn((poly[j]-p)*(poly[(j+1)%4]-p))<0)return 0;
return 1;
}())in[i]=1;
}
}
bool fg=1;
FR(i,n)fg&=in[i];
if(fg)r=mid;else l=mid;
}
}
if(r>3e6)cout<<"impossible\n";
else cout<<fixed<<setprecision(15)<<atan(r)*180/PI<<"\n";
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
sol();
return 0;
}
/*
3 2
3
20 30
50 50
10 50
4
40 20
60 10
75 20
60 30
4
45 60
55 55
60 60
55 65
0 30 20 78 70 5
55 0 20 70 60 10
*/
详细
Test #1:
score: 100
Accepted
time: 1ms
memory: 3876kb
input:
1 1 3 -5 0 5 0 0 5 -10 10 10 10 10 10
output:
44.999999999999859
result:
ok
Test #2:
score: 0
Accepted
time: 1ms
memory: 3876kb
input:
1 1 3 -5 0 5 0 0 5 -10 0 10 10 0 10
output:
26.565051177077761
result:
ok
Test #3:
score: 0
Accepted
time: 1ms
memory: 3948kb
input:
1 1 3 -5 0 5 0 0 5 0 10 10 10 0 10
output:
46.686143341716760
result:
ok
Test #4:
score: 0
Accepted
time: 1ms
memory: 3948kb
input:
1 1 3 -5 0 5 0 0 5 0 10 5 10 0 10
output:
59.491041133797032
result:
ok
Test #5:
score: 0
Accepted
time: 0ms
memory: 3908kb
input:
1 1 3 -5 0 5 0 0 5 0 10 20 -10 0 10
output:
31.219698447368218
result:
ok
Test #6:
score: 0
Accepted
time: 1ms
memory: 3880kb
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.528807709151390
result:
ok
Test #7:
score: 0
Accepted
time: 1ms
memory: 3964kb
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:
44.999999999999978
result:
ok
Test #8:
score: 0
Accepted
time: 1ms
memory: 3896kb
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.434948822921983
result:
ok
Test #9:
score: 0
Accepted
time: 1ms
memory: 3840kb
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: 1ms
memory: 3800kb
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: 1ms
memory: 3956kb
input:
1 1 4 0 0 40 0 40 40 0 40 -100 -100 20 100 100 10
output:
63.665752153146858
result:
ok
Test #12:
score: 0
Accepted
time: 1ms
memory: 3956kb
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.313856658283039
result:
ok
Test #13:
score: 0
Accepted
time: 4ms
memory: 3888kb
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:
53.790638431072458
result:
ok
Test #14:
score: 0
Accepted
time: 22ms
memory: 4112kb
input:
100 1 100 461002 481444 460618 481480 460584 481512 460833 481595 460670 481605 460545 481607 460942 481801 460526 481672 460912 481923 460765 481903 460505 481781 460430 481766 460589 481959 460593 482032 460477 481972 460440 481994 460510 482183 460285 481888 460387 482179 460246 481963 460303 482...
output:
impossible
result:
ok
Test #15:
score: 0
Accepted
time: 27ms
memory: 4284kb
input:
100 1 100 461002 481444 460618 481480 460584 481512 460833 481595 460670 481605 460545 481607 460942 481801 460526 481672 460912 481923 460765 481903 460505 481781 460430 481766 460589 481959 460593 482032 460477 481972 460440 481994 460510 482183 460285 481888 460387 482179 460246 481963 460303 482...
output:
33.690795609720868
result:
ok
Test #16:
score: 0
Accepted
time: 37ms
memory: 4244kb
input:
100 1 100 461002 481444 460618 481480 460584 481512 460833 481595 460670 481605 460545 481607 460942 481801 460526 481672 460912 481923 460765 481903 460505 481781 460430 481766 460589 481959 460593 482032 460477 481972 460440 481994 460510 482183 460285 481888 460387 482179 460246 481963 460303 482...
output:
66.402796642065929
result:
ok
Test #17:
score: 0
Accepted
time: 255ms
memory: 4292kb
input:
100 100 100 461002 481444 460618 481480 460584 481512 460833 481595 460670 481605 460545 481607 460942 481801 460526 481672 460912 481923 460765 481903 460505 481781 460430 481766 460589 481959 460593 482032 460477 481972 460440 481994 460510 482183 460285 481888 460387 482179 460246 481963 460303 4...
output:
4.189001647131438
result:
ok
Test #18:
score: 0
Accepted
time: 117ms
memory: 4224kb
input:
100 11 100 461002 481444 460618 481480 460584 481512 460833 481595 460670 481605 460545 481607 460942 481801 460526 481672 460912 481923 460765 481903 460505 481781 460430 481766 460589 481959 460593 482032 460477 481972 460440 481994 460510 482183 460285 481888 460387 482179 460246 481963 460303 48...
output:
32.411928477174160
result:
ok
Test #19:
score: 0
Accepted
time: 248ms
memory: 4200kb
input:
100 90 100 461002 481444 460618 481480 460584 481512 460833 481595 460670 481605 460545 481607 460942 481801 460526 481672 460912 481923 460765 481903 460505 481781 460430 481766 460589 481959 460593 482032 460477 481972 460440 481994 460510 482183 460285 481888 460387 482179 460246 481963 460303 48...
output:
5.575448935978946
result:
ok
Extra Test:
score: 0
Extra Test Passed