QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#352728 | #5106. Islands from the Sky | PorNPtree# | AC ✓ | 52ms | 4444kb | C++14 | 1.8kb | 2024-03-13 16:13:58 | 2024-03-13 16:13:59 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
const int N = 105;
vector< pair<int, int> > p[N];
int n, m, _a[N], _b[N], _c[N], _d[N], _e[N], _f[N];
double calc(int x, int y, int id)
{
double t = -atan2(_e[id] - _b[id], _d[id] - _a[id]);
double ta = _a[id] * cos(t) - _b[id] * sin(t), tb = _a[id] * sin(t) + _b[id] * cos(t), tc = _c[id];
double td = _d[id] * cos(t) - _e[id] * sin(t), te = _d[id] * sin(t) + _e[id] * cos(t), tf = _f[id];
if (ta > td) {
swap(ta, td), swap(tb, te), swap(tc, tf);
}
double tx = x * cos(t) - y * sin(t), ty = x * sin(t) + y * cos(t);
tx -= ta, ty -= tb;
td -= ta, te -= tb;
if (tx < -1e-8 || tx > td + 1e-8) {
return 1e9;
}
double va = tc * (td - tx) / td + tf * tx / td;
double p = va, q = fabs(ty), r = atan(q / p);
return r / acos(-1.0) * 180;
}
signed main()
{
scanf("%d%d", &n, &m);
for (int i = 1; i <= n; ++i) {
int z;
scanf("%d", &z);
while (z--) {
int x, y;
scanf("%d%d", &x, &y);
p[i].push_back(make_pair(x, y));
}
}
for (int i = 1; i <= m; ++i) {
scanf("%d%d%d%d%d%d", &_a[i], &_b[i], &_c[i], &_d[i], &_e[i], &_f[i]);
}
double res = 0;
for (int i = 1; i <= n; ++i) {
double mn = 1e9;
for (int j = 1; j <= m; ++j) {
double mx = 0;
for (int k = 0; k < (int)p[i].size() && mx < 1e8; ++k) {
mx = max(mx, calc(p[i][k].first, p[i][k].second, j));
}
mn = min(mn, mx);
}
if (mn > 1e8) {
puts("impossible");
return 0;
}
res = max(res, mn);
}
printf("%.10lf\n", res);
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 4152kb
input:
1 1 3 -5 0 5 0 0 5 -10 10 10 10 10 10
output:
45.0000000000
result:
ok
Test #2:
score: 0
Accepted
time: 0ms
memory: 4212kb
input:
1 1 3 -5 0 5 0 0 5 -10 0 10 10 0 10
output:
26.5650511771
result:
ok
Test #3:
score: 0
Accepted
time: 1ms
memory: 4268kb
input:
1 1 3 -5 0 5 0 0 5 0 10 10 10 0 10
output:
46.6861433417
result:
ok
Test #4:
score: 0
Accepted
time: 0ms
memory: 4256kb
input:
1 1 3 -5 0 5 0 0 5 0 10 5 10 0 10
output:
59.4910411338
result:
ok
Test #5:
score: 0
Accepted
time: 0ms
memory: 4268kb
input:
1 1 3 -5 0 5 0 0 5 0 10 20 -10 0 10
output:
31.2196984474
result:
ok
Test #6:
score: 0
Accepted
time: 0ms
memory: 4248kb
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.5288077092
result:
ok
Test #7:
score: 0
Accepted
time: 0ms
memory: 4068kb
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: 0ms
memory: 4320kb
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: 0ms
memory: 3976kb
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: 4000kb
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: 4320kb
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: 0ms
memory: 4332kb
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: 1ms
memory: 4192kb
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: 2ms
memory: 4260kb
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: 4300kb
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: 2ms
memory: 4336kb
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: 52ms
memory: 4444kb
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: 7ms
memory: 4332kb
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: 47ms
memory: 4368kb
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