QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#385552 | #5106. Islands from the Sky | SolitaryDream# | AC ✓ | 30ms | 4440kb | C++17 | 1.8kb | 2024-04-10 21:08:58 | 2024-04-10 21:08:59 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,s,t) for(int i=(s),_t=(t); i<=_t; ++i)
#define DOR(i,s,t) for(int i=(s),_t=(t); i>=_t; --i)
typedef double db;
typedef long long ll;
struct Point {
ll 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};
}
Point normal() const{
return {-y,x};
}
db Len() const{
return hypot(x,y);
}
ll Len2() const{
return x*x+y*y;
}
};
ll det(Point a,Point b) {
return a.x*b.y-a.y*b.x;
}
ll dot(Point a,Point b) {
return a.x*b.x+a.y*b.y;
}
const int N=105;
vector<Point> a[N];
db mn[N];
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout << fixed << setprecision(9);
int n,m;
cin >> n >> m;
FOR(i,1,n) {
int K;
cin >> K;
while(K--) {
ll x,y;
cin >> x >> y;
a[i].push_back({x,y});
}
mn[i]=1e9;
}
while(m--) {
Point s,t;
db hs,ht;
cin >> s.x >> s.y >> hs;
cin >> t.x >> t.y >> ht;
Point d=(t-s).normal();
FOR(i,1,n) {
db r=0;
for(auto p: a[i]) {
if(det(d,p-s)>0 || det(d,p-t)<0) r=1e9;
else {
db u=dot(p-s,t-s)/(t-s).Len();
db v=sqrt(max(0.0,(p-s).Len2()-u*u));
db h=hs+(ht-hs)*u/(t-s).Len();
r=max(r,atan(v/h));
}
}
mn[i]=min(mn[i],r);
}
}
db pi=acos(-1);
db r=mn[1];
FOR(i,2,n) r=max(r,mn[i]);
if(r>1e8) cout << "impossible\n";
else cout << r/pi*180 << '\n';
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 4112kb
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: 4112kb
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: 4248kb
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: 4144kb
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: 4184kb
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: 0ms
memory: 4256kb
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: 4216kb
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: 4252kb
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: 0ms
memory: 4112kb
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: 4016kb
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: 4248kb
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: 4256kb
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: 0
Accepted
time: 1ms
memory: 4312kb
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.790638431
result:
ok
Test #14:
score: 0
Accepted
time: 2ms
memory: 4320kb
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: 2ms
memory: 4440kb
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.690795610
result:
ok
Test #16:
score: 0
Accepted
time: 2ms
memory: 4340kb
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.402796642
result:
ok
Test #17:
score: 0
Accepted
time: 30ms
memory: 4264kb
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.189001647
result:
ok
Test #18:
score: 0
Accepted
time: 5ms
memory: 4308kb
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.411928477
result:
ok
Test #19:
score: 0
Accepted
time: 27ms
memory: 4348kb
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.575448936
result:
ok
Extra Test:
score: 0
Extra Test Passed