QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#187183 | #3854. Radar | RiverHamster# | WA | 79ms | 5612kb | C++17 | 1.1kb | 2023-09-24 15:14:43 | 2023-09-24 15:14:43 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int r[N], R, F, n;
double f[N];
double check(double cur_r, double tag) {
int rp = lower_bound(r + 1, r + R + 1, (int)ceil(tag)) - r;
double res = 1e30;
if(rp <= R) {
res = min(res, cur_r * cur_r + (double)r[rp] * r[rp] - 2 * tag * r[rp]);
}
if(rp > 1) {
res = min(res, cur_r * cur_r + (double)r[rp - 1] * r[rp - 1] - 2 * tag * r[rp - 1]);
}
return res;
}
int main() {
scanf("%d %d %d", &R, &F, &n);
for(int i = 1; i <= R; i++) {
scanf("%d", &r[i]);
}
sort(r + 1, r + R + 1);
for(int i = 1; i <= F; i++) {
int x, y;
scanf("%d %d", &x, &y);
f[i] = atan2(y, x);
}
sort(f + 1, f + F + 1);
for(int i = 1; i <= n; i++) {
int x, y;
scanf("%d %d", &x, &y);
double cur_f = atan2(y, x);
int fp = lower_bound(f + 1, f + F + 1, cur_f) - f;
if(fp > F) fp = 1;
double cur_r = sqrt(1ll * x * x + 1ll * y * y);
printf("%.15lg\n", sqrt(min(check(cur_r, cur_r * cos(cur_f - f[fp])),
check(cur_r, cur_r * cos(cur_f - f[fp == 1 ? F : fp - 1])))));
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 4412kb
input:
3 8 4 2 4 7 1 0 2 1 0 1 -1 1 -5 -2 -5 -6 -2 -7 6 -1 -1 -1 3 1 -5 -3 8 1
output:
0.60529107291664 0.977772290465603 1.55184510540179 1.4142135623731
result:
ok 4 numbers
Test #2:
score: 0
Accepted
time: 0ms
memory: 4304kb
input:
1 8 32 7 0 1 1 0 0 -1 -1 0 1 -1 -1 1 -1 -1 1 1 20 10 10 20 -20 10 10 -20 -10 20 20 -10 -10 -20 -20 -10 2 1 1 2 -2 1 1 -2 -1 2 2 -1 -1 -2 -2 -1 5 0 0 5 -5 0 0 -5 5 5 5 -5 -5 5 -5 -5 9 0 0 9 -9 0 0 -9 9 9 9 -9 -9 9 -9 -9
output:
15.8749850992576 15.8749850992576 15.8749850992576 15.8749850992576 15.8749850992576 15.8749850992576 15.8749850992576 15.8749850992576 4.92965670104572 4.92965670104572 4.92965670104572 4.92965670104572 4.92965670104572 4.92965670104572 4.92965670104572 4.92965670104572 2 2 2 2 0.0710678118654495 0...
result:
ok 32 numbers
Test #3:
score: 0
Accepted
time: 1ms
memory: 4396kb
input:
3 4 1681 16 8 4 -1 0 0 -1 0 1 1 0 -9 17 -4 -7 2 -13 -11 -17 15 -19 -7 1 -8 14 -8 -7 -8 20 -16 -3 12 14 -3 12 9 -5 -18 11 3 -1 2 0 -18 0 0 -19 -1 -19 18 -8 2 20 5 -8 -8 -19 -9 -16 20 -19 14 -1 3 10 -1 -4 4 10 16 17 19 -7 -17 4 1 -12 -5 -12 -5 -10 -15 -5 -10 -19 -2 -10 -4 -16 -2 4 -14 8 -17 16 4 1 16 ...
output:
9.05538513813742 4.12310562561766 3.60555127546399 11.0453610171873 15.2970585407784 1.4142135623731 8.24621125123532 7 8.94427190999916 3 12.1655250605964 5 5.09901951359278 11.1803398874989 1.4142135623731 2 2 3 3.16227766016838 8.24621125123532 4.47213595499958 5 8.54400374531753 9 19.41648783894...
result:
ok 1681 numbers
Test #4:
score: 0
Accepted
time: 1ms
memory: 4416kb
input:
3 4 1681 16 8 4 -1 -1 1 -1 -1 1 1 1 17 1 13 7 -13 -18 -1 18 4 -12 -9 3 5 10 -10 1 -12 -4 14 10 -18 19 0 -3 -7 3 -16 11 -15 9 16 1 -8 -12 3 1 0 -2 15 -18 -14 20 9 -19 17 12 20 5 -3 -6 12 -1 9 10 -13 -9 -20 -15 -11 6 17 -2 -10 -19 15 -8 -6 17 18 15 2 -3 18 -12 8 -3 -11 -6 19 -15 20 0 3 4 2 -16 -6 -17 ...
output:
11.7773721193036 4.63159368259021 6.89565610097726 12.2914229053669 6.55596400358055 4.27030420604702 4.39253600044764 6.36782588574528 6.55596400358055 2.99031637937051 10.1875203594951 2.83362616650871 2.97706483136535 4.69677986016195 4.35223988869313 11.3284558097968 3.38403014770992 1.836459365...
result:
ok 1681 numbers
Test #5:
score: 0
Accepted
time: 0ms
memory: 4204kb
input:
1 4 16 7 0 1 1 0 0 -1 -1 0 3 0 0 3 -3 0 0 -3 3 3 3 -3 -3 3 -3 -3 8 0 0 8 -8 0 0 -8 8 8 8 -8 -8 8 -8 -8
output:
4 4 4 4 5 5 5 5 1 1 1 1 8.06225774829855 8.06225774829855 8.06225774829855 8.06225774829855
result:
ok 16 numbers
Test #6:
score: 0
Accepted
time: 0ms
memory: 4296kb
input:
30 4 120 128 1 2 256 4 512 1024 2048 8 4096 32768 131072 262144 524288 8192 268167 16 536334 16384 1047 32 2095 8380 64 134083 65536 4190 67041 33520 16760 536334 0 -536335 0 0 536334 0 -536335 -1 1 -2 2 -4 4 -8 8 -16 16 -32 32 -64 64 -128 128 -256 256 -512 512 -1024 1024 -2048 2048 -4096 4096 -8192...
output:
1 2 4 8 16 32 64 128 256 512 1024 2048 4096 8192 16384 32768 65536 131072 262144 524288 1047.00047755481 2095.00023866347 4190.00011933174 8380.00005966587 16760.0000298329 33520.0000149165 67041.0000074581 134083.000003729 268167.000001864 536334.000000932 1 2 4 8 16 32 64 128 256 512 1024 2048 409...
result:
ok 120 numbers
Test #7:
score: 0
Accepted
time: 1ms
memory: 4316kb
input:
4 4 1681 1000 1 999000 999 999000 999000 -999001 999000 999000 -999001 -999001 -999001 9 2 -17 -3 15 3 -19 -6 -6 -16 19 6 -12 -16 1 4 4 12 4 -15 -1 -17 5 7 12 13 19 -19 6 -16 -9 -19 6 -10 1 -20 18 17 -2 -20 13 -13 2 -7 13 14 -15 -7 7 -2 -3 4 -15 11 13 -15 20 -20 13 5 14 -5 13 11 20 0 -4 18 -2 -2 -18...
output:
8.39307159589956 16.4534412434766 14.4756400852358 19.0432313681442 16.1829324174512 19.0432313681442 19.0105765365902 3.30589355366057 11.7631876207952 14.6673083600556 16.2955256397971 7.61770551094769 16.6926529030191 25.8700576850889 16.1829321987597 20.0848704315849 10.6945116845406 19.29511600...
result:
ok 1681 numbers
Test #8:
score: 0
Accepted
time: 0ms
memory: 4376kb
input:
3 3 108 8 16 4 0 1 0 -1 -1 0 0 0 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 0 10 0 11 0 12 0 13 0 14 0 15 0 16 0 17 0 18 0 19 0 0 0 -1 0 -2 0 -3 0 -4 0 -5 0 -6 0 -7 0 -8 0 -9 0 -10 0 -11 0 -12 0 -13 0 -14 0 -15 0 -16 0 -17 0 -18 0 -19 0 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 0 10 0 11 0 12 0 13 0 14 0 15 0 16...
output:
4 3 2 1 0 1 2 1 0 1 2 3 4 3 2 1 0 1 2 3 4 3 2 1 0 1 2 1 0 1 2 3 4 3 2 1 0 1 2 3 4 4.12310562561766 4.47213595499958 5 5.65685424949238 6.40312423743285 7.21110255092798 8.06225774829855 8.94427190999916 9.8488578017961 10.770329614269 11.7046999107196 12.6491106406735 13.6014705087354 14.56021977856...
result:
ok 108 numbers
Test #9:
score: 0
Accepted
time: 1ms
memory: 4452kb
input:
3 3 1681 8 16 4 -1 0 0 1 0 -1 9 2 -17 -3 15 3 -19 -6 -6 -16 19 6 -12 -16 1 4 4 12 4 -15 -1 -17 5 7 12 13 19 -19 6 -16 -9 -19 6 -10 1 -20 18 17 -2 -20 13 -13 2 -7 13 14 -15 -7 7 -2 -3 4 -15 11 13 -15 20 -20 13 5 14 -5 13 11 20 0 -4 18 -2 -2 -18 7 6 -3 -9 -9 -8 -12 -16 20 -1 -13 14 20 -7 -14 13 -14 19...
output:
9.21954445729289 3.16227766016838 15.0332963783729 6.70820393249937 6 19.1049731745428 12 1 5.65685424949238 4.12310562561766 1.4142135623731 5.09901951359278 12.369316876853 19.2353840616713 6 9.48683298050514 6.32455532033676 4.12310562561766 18.0277563773199 4.47213595499958 13.3416640641263 2.23...
result:
ok 1681 numbers
Test #10:
score: 0
Accepted
time: 1ms
memory: 4320kb
input:
3 2 1681 16 8 4 0 1 0 -1 -1 -17 -18 -12 4 -6 12 17 -14 -11 -10 19 -19 -15 -15 -17 2 13 -8 -13 -18 7 -17 12 -20 16 3 12 -13 13 10 5 18 -9 -16 4 1 17 -19 -6 -17 -4 12 -18 -10 -17 -9 -20 13 6 11 0 4 5 2 -15 8 -12 1 9 17 -10 1 -13 -8 1 -12 11 5 0 20 -16 -5 8 -13 -2 7 12 -8 14 -4 9 10 -11 19 -3 -18 8 -4 ...
output:
1.4142135623731 18.4390889145858 4.47213595499958 12.0415945787923 14.3178210632764 10.4403065089106 19.0262975904404 15.0332963783729 3.60555127546399 8.54400374531753 18.0277563773199 17.464249196573 20 5 13.3416640641263 10.0498756211209 18.0277563773199 16 1.4142135623731 19.1049731745428 17 12....
result:
ok 1681 numbers
Test #11:
score: 0
Accepted
time: 1ms
memory: 4312kb
input:
3 2 1681 16 8 4 -1 -999001 0 1 13 -1 -7 19 19 -13 17 -1 -14 14 18 -9 10 -10 11 20 6 16 -16 7 14 -7 -3 4 7 -14 -20 2 14 -6 13 16 -16 -13 2 0 -8 20 -3 20 0 14 -18 1 -15 12 -3 -12 -13 -14 14 0 12 4 -14 9 -10 -9 20 15 -20 0 19 4 16 -8 3 -14 19 -15 -11 19 6 -9 -17 -5 -17 13 18 12 6 12 -16 -10 12 7 8 -6 -...
output:
13.3416679655883 7.61577310586391 19.2353998816819 17.2626804447051 14.1421356237309 18.0277643729907 10.1980468796765 11.7046999107196 6 16.0312195418814 14.0356768352672 3 7.28012528904718 20.0997512422418 14.142139587489 13 16.2788048544176 4.47213595499958 8.94427190999916 5 2 18.2482875908947 1...
result:
ok 1681 numbers
Test #12:
score: 0
Accepted
time: 0ms
memory: 4300kb
input:
3 2 1 1 2 4 0 1 0 -1 -7 0
output:
7.07106781186548
result:
ok found '7.0710678', expected '7.0710678', error '0.0000000'
Test #13:
score: 0
Accepted
time: 0ms
memory: 4324kb
input:
3 2 1 1 2 4 0 1 -1 -999001 -7 0
output:
7.07106682092596
result:
ok found '7.0710668', expected '7.0710668', error '0.0000000'
Test #14:
score: 0
Accepted
time: 0ms
memory: 4392kb
input:
4 1 36 8 1 2 4 0 1 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 0 -1 0 -2 0 -3 0 -4 0 -5 0 -6 0 -7 0 -8 0 -9 -1 0 -2 0 -3 0 -4 0 -5 0 -6 0 -7 0 -8 0 -9 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 0
output:
0 0 1 0 1 2 1 0 1 2 3 4 5 6 7 8 9 10 1.41421356237309 2.23606797749979 3.16227766016838 4.12310562561766 5.09901951359278 6.08276253029822 7.07106781186548 8.06225774829855 9.05538513813742 1.41421356237309 2.23606797749979 3.16227766016838 4.12310562561766 5.09901951359278 6.08276253029822 7.071067...
result:
ok 36 numbers
Test #15:
score: 0
Accepted
time: 0ms
memory: 4308kb
input:
4 5 8 8 1 2 4 0 1 1 1 1 -1 -3 2 -2 -5 -4 0 -4 -1 -4 -2 -8 -1 -8 -2 -8 -3 -8 -4 -9 -3
output:
2.31827318950744 3.14737923922355 3.04300366455654 5.60113965763751 6.2947584784471 6.55343849685729 6.08600732911308 7.48016453311801
result:
ok 8 numbers
Test #16:
score: 0
Accepted
time: 73ms
memory: 5612kb
input:
99999 99999 99999 10 20 30 40 50 60 70 80 90 100 110 120 130 140 150 160 170 180 190 200 210 220 230 240 250 260 270 280 290 300 310 320 330 340 350 360 370 380 390 400 410 420 430 440 450 460 470 480 490 500 510 520 530 540 550 560 570 580 590 600 610 620 630 640 650 660 670 680 690 700 710 720 730...
output:
10.9988657018687 14.5254230187611 21.0731021177943 31.8431891132411 115.924895013616 49.9913910549399 60.5066297164416 69.9581300395859 134.902308151242 90.1725614314229 100.220151411668 110.15485288507 119.83813805765 169.259259924831 139.857713809972 149.903862612096 159.813034019318 169.924008912...
result:
ok 99999 numbers
Test #17:
score: -100
Wrong Answer
time: 79ms
memory: 5488kb
input:
99999 99999 99999 10 20 30 40 50 60 70 80 90 100 110 120 130 140 150 160 170 180 190 200 210 220 230 240 250 260 270 280 290 300 310 320 330 340 350 360 370 380 390 400 410 420 430 440 450 460 470 480 490 500 510 520 530 540 550 560 570 580 590 600 610 620 630 640 650 660 670 680 690 700 710 720 730...
output:
10 15.2958413089682 21.4720815031587 30.8393085198004 35.0065552725237 50.9314581074773 60.5066198289977 70.3637954422017 80.0070389371158 90.0561713216274 100.000633293052 110.050508279774 119.838128085721 129.885197989282 134.868076476159 149.833874636269 159.950469676917 169.923998940019 174.7854...
result:
wrong answer 50045th numbers differ - expected: '2.4915616', found: '2.4915874', error = '0.0000104'