# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
903924 |
2024-01-11T14:42:01 Z |
tz74 |
Mobile (BOI12_mobile) |
C++17 |
|
777 ms |
36112 KB |
#include <iostream>
#include <vector>
#include <iomanip>
#include <ctgmath>
using namespace std;
using i64 = long long;
using f64 = double;
i64 N;
f64 L;
vector<pair<i64, i64> > towers;
f64 sq(f64 in) {
return in * in;
}
bool contiguous(f64 R) {
f64 rightmost = 0;
for (int i = 0; i < N; i++) {
f64 x = towers[i].first;
f64 y = towers[i].second;
f64 d = sq(2.0 * x) - 4.0 * (sq(x) + sq(y) - sq(R));
if (d > 0) {
f64 x1 = (2.0 * x - sqrt(d)) / 2;
f64 x2 = (2.0 * x + sqrt(d)) / 2;
// printf("i: %d, x1: %lf, x2: %lf\n", i, x1, x2);
if (x1 < rightmost) {
rightmost = max(rightmost, x2);
}
}
}
// printf("leftmost: %lf, rightmost: %lf\n", leftmost, rightmost);
return rightmost >= L;
}
int main(void) {
cin >> N >> L;
for (int i = 0; i < N; i++) {
pair<i64, i64> p;
cin >> p.first >> p.second;
towers.push_back(p);
}
// printf("contiguous: %d\n", contiguous(7.8102));
// return 0;
f64 lo = 1.0;
f64 hi = 1.5e9;
while (hi - lo > 1e-4) {
f64 mid = (hi + lo) / 2;
// we want the largest value where it's not contiguous
if (contiguous(mid)) {
hi = mid;
} else {
lo = mid;
}
}
cout << fixed << setprecision(4) << lo << endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
344 KB |
Output is correct |
3 |
Correct |
1 ms |
360 KB |
Output is correct |
4 |
Correct |
1 ms |
356 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
360 KB |
Output is correct |
2 |
Correct |
0 ms |
360 KB |
Output is correct |
3 |
Correct |
0 ms |
360 KB |
Output is correct |
4 |
Correct |
1 ms |
360 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
360 KB |
Output is correct |
2 |
Correct |
2 ms |
344 KB |
Output is correct |
3 |
Correct |
2 ms |
348 KB |
Output is correct |
4 |
Correct |
3 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
600 KB |
Output is correct |
2 |
Correct |
4 ms |
608 KB |
Output is correct |
3 |
Correct |
3 ms |
604 KB |
Output is correct |
4 |
Correct |
4 ms |
604 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
616 KB |
Output is correct |
2 |
Correct |
5 ms |
616 KB |
Output is correct |
3 |
Correct |
3 ms |
616 KB |
Output is correct |
4 |
Correct |
5 ms |
720 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
616 KB |
Output is correct |
2 |
Correct |
5 ms |
772 KB |
Output is correct |
3 |
Correct |
3 ms |
616 KB |
Output is correct |
4 |
Correct |
5 ms |
616 KB |
Output is correct |
5 |
Correct |
3 ms |
600 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
51 ms |
2508 KB |
Output is correct |
2 |
Correct |
52 ms |
2500 KB |
Output is correct |
3 |
Correct |
30 ms |
2000 KB |
Output is correct |
4 |
Correct |
46 ms |
3532 KB |
Output is correct |
5 |
Correct |
32 ms |
1808 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
43 ms |
2508 KB |
Output is correct |
2 |
Correct |
51 ms |
2500 KB |
Output is correct |
3 |
Correct |
61 ms |
2496 KB |
Output is correct |
4 |
Correct |
49 ms |
3668 KB |
Output is correct |
5 |
Correct |
82 ms |
3880 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
49 ms |
2508 KB |
Output is correct |
2 |
Correct |
63 ms |
2424 KB |
Output is correct |
3 |
Correct |
48 ms |
3388 KB |
Output is correct |
4 |
Correct |
80 ms |
4008 KB |
Output is correct |
5 |
Correct |
54 ms |
3280 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
75 ms |
2528 KB |
Output is correct |
2 |
Correct |
64 ms |
3532 KB |
Output is correct |
3 |
Correct |
75 ms |
3268 KB |
Output is correct |
4 |
Correct |
70 ms |
4024 KB |
Output is correct |
5 |
Correct |
74 ms |
3568 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
80 ms |
3176 KB |
Output is correct |
2 |
Correct |
62 ms |
3740 KB |
Output is correct |
3 |
Correct |
58 ms |
3476 KB |
Output is correct |
4 |
Correct |
76 ms |
4060 KB |
Output is correct |
5 |
Correct |
56 ms |
3472 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
278 ms |
10932 KB |
Output is correct |
2 |
Correct |
312 ms |
16044 KB |
Output is correct |
3 |
Correct |
336 ms |
15620 KB |
Output is correct |
4 |
Correct |
332 ms |
17924 KB |
Output is correct |
5 |
Correct |
297 ms |
15024 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
330 ms |
13472 KB |
Output is correct |
2 |
Correct |
411 ms |
15340 KB |
Output is correct |
3 |
Correct |
291 ms |
13912 KB |
Output is correct |
4 |
Correct |
320 ms |
17488 KB |
Output is correct |
5 |
Correct |
326 ms |
15500 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
312 ms |
20312 KB |
Output is correct |
2 |
Correct |
391 ms |
25456 KB |
Output is correct |
3 |
Correct |
398 ms |
25248 KB |
Output is correct |
4 |
Correct |
462 ms |
27588 KB |
Output is correct |
5 |
Correct |
338 ms |
25264 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
438 ms |
23032 KB |
Output is correct |
2 |
Correct |
498 ms |
24924 KB |
Output is correct |
3 |
Correct |
327 ms |
23464 KB |
Output is correct |
4 |
Correct |
406 ms |
27600 KB |
Output is correct |
5 |
Correct |
375 ms |
26528 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
367 ms |
19848 KB |
Output is correct |
2 |
Correct |
483 ms |
27088 KB |
Output is correct |
3 |
Correct |
458 ms |
26028 KB |
Output is correct |
4 |
Correct |
495 ms |
28556 KB |
Output is correct |
5 |
Correct |
389 ms |
25040 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
492 ms |
24236 KB |
Output is correct |
2 |
Correct |
576 ms |
24048 KB |
Output is correct |
3 |
Correct |
397 ms |
23924 KB |
Output is correct |
4 |
Correct |
477 ms |
27916 KB |
Output is correct |
5 |
Correct |
404 ms |
25132 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
420 ms |
22788 KB |
Output is correct |
2 |
Correct |
550 ms |
26944 KB |
Output is correct |
3 |
Correct |
516 ms |
25008 KB |
Output is correct |
4 |
Correct |
558 ms |
30344 KB |
Output is correct |
5 |
Correct |
495 ms |
24956 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
511 ms |
26336 KB |
Output is correct |
2 |
Correct |
609 ms |
25048 KB |
Output is correct |
3 |
Correct |
470 ms |
24236 KB |
Output is correct |
4 |
Correct |
533 ms |
30440 KB |
Output is correct |
5 |
Correct |
487 ms |
26112 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
565 ms |
24440 KB |
Output is correct |
2 |
Correct |
650 ms |
31768 KB |
Output is correct |
3 |
Correct |
631 ms |
30784 KB |
Output is correct |
4 |
Correct |
675 ms |
35280 KB |
Output is correct |
5 |
Correct |
559 ms |
29864 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
723 ms |
31236 KB |
Output is correct |
2 |
Correct |
777 ms |
29436 KB |
Output is correct |
3 |
Correct |
627 ms |
28608 KB |
Output is correct |
4 |
Correct |
648 ms |
36112 KB |
Output is correct |
5 |
Correct |
578 ms |
30884 KB |
Output is correct |