#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define int long long
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define FORD(i, a, b) for (int i = (b); i >= (a); i --)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPD(i, n) for (int i = (n) - 1; i >= 0; --i)
#define MASK(i) (1LL << (i))
#define BIT(x, i) (((x) >> (i)) & 1)
constexpr ll LINF = (1ll << 60);
constexpr int INF = (1ll << 30);
constexpr int Mod = 1e9 + 7;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
/*
Phu Trong from Nguyen Tat Thanh High School for gifted student
*/
template <class X, class Y>
bool minimize(X &x, const Y &y){
X eps = 1e-9;
if (x > y + eps) {x = y; return 1;}
return 0;
}
template <class X, class Y>
bool maximize(X &x, const Y &y){
X eps = 1e-9;
if (x + eps < y) {x = y; return 1;}
return 0;
}
#define MAX 1000005
int numPoint;
double lim;
struct Point{
double x, y;
Point(){}
Point(double _x, double _y): x(_x), y(_y){}
} A[MAX];
const double eps = 1e-5;
double dist(Point a, Point b){
return (double)(sqrt((a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y)));
}
signed main(){
#define name "Whisper"
cin.tie(nullptr) -> sync_with_stdio(false);
//freopen(name".inp", "r", stdin);
//freopen(name".out", "w", stdout);
cin >> numPoint >> lim;
for (int i = 1; i <= numPoint; ++i){
cin >> A[i].x >> A[i].y;
}
double ans = 0.0;
double l = 1, r = 1.5e9;
auto check = [&](double dist) -> bool{
double cur = 0;
for (int i = 1; i <= numPoint; ++i){
double l = A[i].x - sqrt(dist * dist - A[i].y * A[i].y);
double r = A[i].x + sqrt(dist * dist - A[i].y * A[i].y);
if (l <= cur) maximize(cur, r);
}
return cur >= lim;
};
while (r - l > eps){
double m = (l + r) / 2;
if(check(m)) r = m;
else l = m;
}
cout << setprecision(5) << fixed << r;
}
Compilation message
mobile.cpp: In function 'int main()':
mobile.cpp:62:12: warning: unused variable 'ans' [-Wunused-variable]
62 | double ans = 0.0;
| ^~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
532 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
348 KB |
Output is correct |
2 |
Correct |
2 ms |
604 KB |
Output is correct |
3 |
Correct |
2 ms |
348 KB |
Output is correct |
4 |
Correct |
3 ms |
604 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
348 KB |
Output is correct |
2 |
Correct |
3 ms |
600 KB |
Output is correct |
3 |
Correct |
3 ms |
348 KB |
Output is correct |
4 |
Correct |
3 ms |
476 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
344 KB |
Output is correct |
2 |
Correct |
2 ms |
604 KB |
Output is correct |
3 |
Correct |
2 ms |
348 KB |
Output is correct |
4 |
Correct |
3 ms |
856 KB |
Output is correct |
5 |
Correct |
3 ms |
484 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
43 ms |
3420 KB |
Output is correct |
2 |
Correct |
31 ms |
3416 KB |
Output is correct |
3 |
Correct |
23 ms |
3164 KB |
Output is correct |
4 |
Correct |
45 ms |
3448 KB |
Output is correct |
5 |
Correct |
24 ms |
3092 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
39 ms |
3164 KB |
Output is correct |
2 |
Correct |
39 ms |
3420 KB |
Output is correct |
3 |
Correct |
46 ms |
3408 KB |
Output is correct |
4 |
Correct |
47 ms |
3412 KB |
Output is correct |
5 |
Correct |
56 ms |
3668 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
33 ms |
3164 KB |
Output is correct |
2 |
Correct |
34 ms |
3408 KB |
Output is correct |
3 |
Correct |
36 ms |
3408 KB |
Output is correct |
4 |
Correct |
65 ms |
3920 KB |
Output is correct |
5 |
Correct |
47 ms |
3312 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
43 ms |
3676 KB |
Output is correct |
2 |
Correct |
41 ms |
3632 KB |
Output is correct |
3 |
Correct |
41 ms |
3416 KB |
Output is correct |
4 |
Correct |
65 ms |
3932 KB |
Output is correct |
5 |
Correct |
55 ms |
3404 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
41 ms |
3676 KB |
Output is correct |
2 |
Correct |
41 ms |
3672 KB |
Output is correct |
3 |
Correct |
42 ms |
3416 KB |
Output is correct |
4 |
Correct |
64 ms |
4160 KB |
Output is correct |
5 |
Correct |
55 ms |
3448 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
182 ms |
11140 KB |
Output is correct |
2 |
Correct |
203 ms |
12792 KB |
Output is correct |
3 |
Correct |
201 ms |
12628 KB |
Output is correct |
4 |
Correct |
319 ms |
13888 KB |
Output is correct |
5 |
Correct |
269 ms |
12364 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
217 ms |
13136 KB |
Output is correct |
2 |
Correct |
332 ms |
12368 KB |
Output is correct |
3 |
Correct |
221 ms |
12000 KB |
Output is correct |
4 |
Correct |
313 ms |
13652 KB |
Output is correct |
5 |
Correct |
312 ms |
12504 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
222 ms |
13692 KB |
Output is correct |
2 |
Correct |
259 ms |
15540 KB |
Output is correct |
3 |
Correct |
257 ms |
15500 KB |
Output is correct |
4 |
Correct |
419 ms |
16996 KB |
Output is correct |
5 |
Correct |
364 ms |
15216 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
259 ms |
15956 KB |
Output is correct |
2 |
Correct |
376 ms |
14928 KB |
Output is correct |
3 |
Correct |
257 ms |
14420 KB |
Output is correct |
4 |
Correct |
388 ms |
16980 KB |
Output is correct |
5 |
Correct |
342 ms |
15448 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
256 ms |
16276 KB |
Output is correct |
2 |
Correct |
289 ms |
18416 KB |
Output is correct |
3 |
Correct |
278 ms |
18512 KB |
Output is correct |
4 |
Correct |
483 ms |
19808 KB |
Output is correct |
5 |
Correct |
384 ms |
17660 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
298 ms |
18768 KB |
Output is correct |
2 |
Correct |
422 ms |
17656 KB |
Output is correct |
3 |
Correct |
308 ms |
17516 KB |
Output is correct |
4 |
Correct |
429 ms |
19688 KB |
Output is correct |
5 |
Correct |
408 ms |
18308 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
296 ms |
18820 KB |
Output is correct |
2 |
Correct |
332 ms |
21332 KB |
Output is correct |
3 |
Correct |
317 ms |
20976 KB |
Output is correct |
4 |
Correct |
510 ms |
23120 KB |
Output is correct |
5 |
Correct |
461 ms |
21076 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
341 ms |
21840 KB |
Output is correct |
2 |
Correct |
488 ms |
20560 KB |
Output is correct |
3 |
Correct |
334 ms |
20088 KB |
Output is correct |
4 |
Correct |
511 ms |
22892 KB |
Output is correct |
5 |
Correct |
468 ms |
21136 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
361 ms |
20560 KB |
Output is correct |
2 |
Correct |
414 ms |
23892 KB |
Output is correct |
3 |
Correct |
407 ms |
23380 KB |
Output is correct |
4 |
Correct |
650 ms |
25740 KB |
Output is correct |
5 |
Correct |
573 ms |
23008 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
423 ms |
24484 KB |
Output is correct |
2 |
Correct |
586 ms |
22976 KB |
Output is correct |
3 |
Correct |
420 ms |
22256 KB |
Output is correct |
4 |
Correct |
618 ms |
25960 KB |
Output is correct |
5 |
Correct |
567 ms |
23632 KB |
Output is correct |