#include <string>
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cmath>
#include <array>
#include <map>
#include <set>
#include <fstream>
#include <unordered_map>
#include <queue>
#include <iomanip>
using namespace std;
using pi = pair<int, int>;
using pd = pair<double, double>;
#define ll long long
#define all(x) (x).begin(), (x).end()
int n_stations, l_highway;
vector<pd> locations;
bool works(double radius) {
double curr = 0;
for(int i = 0; i < n_stations; i++) {
double delta = sqrt(radius*radius - locations[i].second*locations[i].second);
double left = locations[i].first - delta, right = locations[i].first + delta;
if(left <= curr) {
curr = max(curr, right);
}
}
return curr >= l_highway;
}
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cin >> n_stations >> l_highway;
for(int i = 0; i < n_stations; i++) {
double x,y; cin >> x >> y;
locations.push_back({x,y});
}
double a = 0, b = 1.5e9;
double ans;
while(b - a > 1e-3) {
double m = (a+b)/2.0;
if(works(m)) {
b = m;
ans = m;
}
else {
a = m;
}
}
cout << fixed << setprecision(4) << ans;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
0 ms |
204 KB |
Output is correct |
4 |
Correct |
0 ms |
304 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
0 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
332 KB |
Output is correct |
2 |
Correct |
3 ms |
332 KB |
Output is correct |
3 |
Correct |
2 ms |
332 KB |
Output is correct |
4 |
Correct |
2 ms |
332 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
460 KB |
Output is correct |
2 |
Correct |
4 ms |
524 KB |
Output is correct |
3 |
Correct |
4 ms |
460 KB |
Output is correct |
4 |
Correct |
5 ms |
460 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
460 KB |
Output is correct |
2 |
Correct |
4 ms |
460 KB |
Output is correct |
3 |
Correct |
4 ms |
460 KB |
Output is correct |
4 |
Correct |
5 ms |
412 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
460 KB |
Output is correct |
2 |
Correct |
6 ms |
432 KB |
Output is correct |
3 |
Correct |
4 ms |
460 KB |
Output is correct |
4 |
Correct |
6 ms |
460 KB |
Output is correct |
5 |
Correct |
4 ms |
460 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
63 ms |
2368 KB |
Output is correct |
2 |
Correct |
60 ms |
2496 KB |
Output is correct |
3 |
Correct |
38 ms |
1448 KB |
Output is correct |
4 |
Correct |
65 ms |
2480 KB |
Output is correct |
5 |
Correct |
34 ms |
1484 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
56 ms |
2404 KB |
Output is correct |
2 |
Correct |
55 ms |
2496 KB |
Output is correct |
3 |
Correct |
64 ms |
2380 KB |
Output is correct |
4 |
Correct |
68 ms |
2496 KB |
Output is correct |
5 |
Correct |
77 ms |
2448 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
58 ms |
2448 KB |
Output is correct |
2 |
Correct |
63 ms |
2408 KB |
Output is correct |
3 |
Correct |
60 ms |
2476 KB |
Output is correct |
4 |
Correct |
99 ms |
2424 KB |
Output is correct |
5 |
Correct |
66 ms |
2404 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
78 ms |
2472 KB |
Output is correct |
2 |
Correct |
75 ms |
2420 KB |
Output is correct |
3 |
Correct |
70 ms |
2480 KB |
Output is correct |
4 |
Correct |
96 ms |
2496 KB |
Output is correct |
5 |
Correct |
79 ms |
2524 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
79 ms |
2408 KB |
Output is correct |
2 |
Correct |
75 ms |
2464 KB |
Output is correct |
3 |
Correct |
72 ms |
2476 KB |
Output is correct |
4 |
Correct |
95 ms |
2448 KB |
Output is correct |
5 |
Correct |
80 ms |
2396 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
336 ms |
8628 KB |
Output is correct |
2 |
Correct |
392 ms |
8616 KB |
Output is correct |
3 |
Correct |
380 ms |
8536 KB |
Output is correct |
4 |
Correct |
473 ms |
8624 KB |
Output is correct |
5 |
Correct |
402 ms |
8608 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
405 ms |
8624 KB |
Output is correct |
2 |
Correct |
447 ms |
8624 KB |
Output is correct |
3 |
Correct |
359 ms |
8576 KB |
Output is correct |
4 |
Correct |
460 ms |
8572 KB |
Output is correct |
5 |
Correct |
414 ms |
8640 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
407 ms |
16804 KB |
Output is correct |
2 |
Correct |
479 ms |
16940 KB |
Output is correct |
3 |
Correct |
463 ms |
16832 KB |
Output is correct |
4 |
Correct |
575 ms |
16972 KB |
Output is correct |
5 |
Correct |
491 ms |
23944 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
485 ms |
16820 KB |
Output is correct |
2 |
Correct |
539 ms |
16756 KB |
Output is correct |
3 |
Correct |
429 ms |
16804 KB |
Output is correct |
4 |
Correct |
570 ms |
16748 KB |
Output is correct |
5 |
Correct |
498 ms |
16836 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
477 ms |
16860 KB |
Output is correct |
2 |
Correct |
554 ms |
16912 KB |
Output is correct |
3 |
Correct |
543 ms |
16824 KB |
Output is correct |
4 |
Correct |
669 ms |
16804 KB |
Output is correct |
5 |
Correct |
567 ms |
23796 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
570 ms |
16928 KB |
Output is correct |
2 |
Correct |
636 ms |
23844 KB |
Output is correct |
3 |
Correct |
512 ms |
23204 KB |
Output is correct |
4 |
Correct |
675 ms |
27208 KB |
Output is correct |
5 |
Correct |
595 ms |
24548 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
546 ms |
16800 KB |
Output is correct |
2 |
Correct |
627 ms |
16772 KB |
Output is correct |
3 |
Correct |
627 ms |
24552 KB |
Output is correct |
4 |
Correct |
765 ms |
28760 KB |
Output is correct |
5 |
Correct |
661 ms |
24356 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
642 ms |
16800 KB |
Output is correct |
2 |
Correct |
711 ms |
24000 KB |
Output is correct |
3 |
Correct |
590 ms |
23204 KB |
Output is correct |
4 |
Correct |
757 ms |
28444 KB |
Output is correct |
5 |
Correct |
667 ms |
24624 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
676 ms |
16860 KB |
Output is correct |
2 |
Correct |
811 ms |
31628 KB |
Output is correct |
3 |
Correct |
773 ms |
30640 KB |
Output is correct |
4 |
Correct |
955 ms |
35316 KB |
Output is correct |
5 |
Correct |
818 ms |
29756 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
804 ms |
18124 KB |
Output is correct |
2 |
Correct |
883 ms |
29420 KB |
Output is correct |
3 |
Correct |
752 ms |
28360 KB |
Output is correct |
4 |
Correct |
963 ms |
35476 KB |
Output is correct |
5 |
Correct |
846 ms |
30848 KB |
Output is correct |