QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#96687 | #5106. Islands from the Sky | marcosk | AC ✓ | 33ms | 4196kb | C++23 | 2.2kb | 2023-04-15 02:56:08 | 2023-04-15 02:56:11 |
Judging History
answer
#include <bits/stdc++.h>
#define fst first
#define snd second
#define fore(i,a,b) for(int i=a,ThxDem=b;i<ThxDem;++i)
#define pb push_back
#define ALL(s) s.begin(),s.end()
#define FIN ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define SZ(s) int(s.size())
using namespace std;
typedef long double ld;
typedef long long ll;
typedef pair<int,int> ii;
ld EPS=1e-9;
struct pt {
double x,y;
pt(double x, double y):x(x),y(y){}
pt(){}
double norm2(){return *this**this;}
double norm(){return sqrt(norm2());}
bool operator==(pt p){return abs(x-p.x)<=EPS&&abs(y-p.y)<=EPS;}
pt operator+(pt p){return pt(x+p.x,y+p.y);}
pt operator-(pt p){return pt(x-p.x,y-p.y);}
pt operator*(double t){return pt(x*t,y*t);}
pt operator/(double t){return pt(x/t,y/t);}
double operator*(pt p){return x*p.x+y*p.y;}
pt unit(){return *this/norm();}
double operator%(pt p){return x*p.y-y*p.x;}
bool left(pt p, pt q){return (q-p)%(*this-p)>-EPS;}
pt rot(pt r){return pt(*this%r,*this*r);}
pt rot(double a){return rot(pt(sin(a),cos(a)));}
};
pt ccw90(1,0);
pt cw90(-1,0);
double pi=acos(-1);
pair<pt,pt> get(pt a, pt b, double z, double tita){
pt dir=(b-a).unit();
double k=z*sin(tita)/sin(pi/2-tita);
pt me=a+(dir.rot(ccw90)*k);
pt he=a+(dir.rot(cw90)*k);
return {me,he};
}
bool has(vector<pt> &a, vector<pt> &b){
for(auto p:b){
fore(i,0,SZ(a)) if(!p.left(a[i],a[(i+1)%SZ(a)])) return 0;
}
return 1;
}
int main(){FIN;
int n,m; cin>>n>>m;
vector<vector<pt>> v;
fore(i,0,n){
int k; cin>>k;
vector<pt> now(k);
fore(i,0,k) cin>>now[i].x>>now[i].y;
v.pb(now);
}
vector<pt> a(m),b(m);
vector<double> za(m),zb(m);
fore(i,0,m) cin>>a[i].x>>a[i].y>>za[i]>>b[i].x>>b[i].y>>zb[i];
double l=0,r=pi/2-EPS;
int it=70;
while(it--){
double mid=(l+r)/2;
vector<int> did(n);
fore(j,0,m){
pair<pt,pt> aa=get(a[j],b[j],za[j],mid);
pair<pt,pt> bb=get(b[j],a[j],zb[j],mid);
vector<pt> now={aa.fst,aa.snd,bb.fst,bb.snd};
fore(i,0,n) did[i]|=has(now,v[i]);
}
int can=1;
fore(i,0,n) can&=did[i];
if(can) r=mid;
else l=mid;
}
if(abs(r-pi/2)<=2*EPS)cout<<"impossible\n";
else cout<<fixed<<setprecision(10)<<r*180/pi<<"\n";
}
详细
Test #1:
score: 100
Accepted
time: 2ms
memory: 3788kb
input:
1 1 3 -5 0 5 0 0 5 -10 10 10 10 10 10
output:
44.9999999999
result:
ok
Test #2:
score: 0
Accepted
time: 2ms
memory: 3812kb
input:
1 1 3 -5 0 5 0 0 5 -10 0 10 10 0 10
output:
26.5650511768
result:
ok
Test #3:
score: 0
Accepted
time: 2ms
memory: 3960kb
input:
1 1 3 -5 0 5 0 0 5 0 10 10 10 0 10
output:
46.6861433415
result:
ok
Test #4:
score: 0
Accepted
time: 2ms
memory: 3872kb
input:
1 1 3 -5 0 5 0 0 5 0 10 5 10 0 10
output:
59.4910411336
result:
ok
Test #5:
score: 0
Accepted
time: 2ms
memory: 3828kb
input:
1 1 3 -5 0 5 0 0 5 0 10 20 -10 0 10
output:
31.2196984472
result:
ok
Test #6:
score: 0
Accepted
time: 2ms
memory: 3820kb
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.5288077090
result:
ok
Test #7:
score: 0
Accepted
time: 2ms
memory: 4024kb
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.0000000000
result:
ok
Test #8:
score: 0
Accepted
time: 2ms
memory: 3820kb
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.4349488229
result:
ok
Test #9:
score: 0
Accepted
time: 1ms
memory: 3952kb
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: 2ms
memory: 3696kb
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: 2ms
memory: 3808kb
input:
1 1 4 0 0 40 0 40 40 0 40 -100 -100 20 100 100 10
output:
63.6657521531
result:
ok
Test #12:
score: 0
Accepted
time: 2ms
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.3138566583
result:
ok
Test #13:
score: 0
Accepted
time: 3ms
memory: 4016kb
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.7906384311
result:
ok
Test #14:
score: 0
Accepted
time: 9ms
memory: 4092kb
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: 6ms
memory: 3996kb
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.6907956097
result:
ok
Test #16:
score: 0
Accepted
time: 10ms
memory: 4028kb
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.4027966421
result:
ok
Test #17:
score: 0
Accepted
time: 29ms
memory: 4196kb
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.1890016471
result:
ok
Test #18:
score: 0
Accepted
time: 24ms
memory: 4092kb
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.4119284772
result:
ok
Test #19:
score: 0
Accepted
time: 33ms
memory: 4076kb
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.5754489360
result:
ok
Extra Test:
score: 0
Extra Test Passed