#include <bits/stdc++.h>
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define int long long
using namespace std;
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx,bmi,bmi2,lzcnt,popcnt")
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pdd = pair<double, double>;
const int mod = 1e9 + 7;
const int LOG = 20;
const int maxn = 1e5 + 5;
const double eps = 1e-9;
int32_t main() {
ios_base::sync_with_stdio(false);
cout.tie(0); cin.tie(0);
int n, L;
cin >> n >> L;
vector<int> x(n), y(n);
for(int i=0; i<n; i++) cin >> x[i] >> y[i];
double l=1, r=2e9, ans=r;
for(int it=0; it<50; it++) {
double mid = (l + r) / 2.0;
vector<pdd> seg;
for(int i=0; i<n; i++) {
if(abs(y[i]) >= mid) continue;
double len = sqrt(mid * mid - y[i] * y[i]);
double left = x[i] - len, right = x[i] + len;
if( right >= 0 && left <= L ) seg.push_back({ max((double)0, x[i] - len), min((double)L, x[i] + len) });
}
if(seg.size() == 0) {
l = mid;
continue;
}
sort(seg.begin(), seg.end());
bool ok = 1;
double lp=seg[0].first, rp=seg[0].second;
if(lp > 0) ok = 0;
for(int i=1; i<seg.size(); i++) {
if(seg[i].first > rp) ok = 0;
rp = max(rp, seg[i].second);
}
if(ok && rp >= L) ans = min(ans, mid), r = mid;
else l = mid;
}
cout << setprecision(8) << fixed << ans << '\n';
return 0;
}
Compilation message
mobile.cpp: In function 'int32_t main()':
mobile.cpp:58:23: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<double, double> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
58 | for(int i=1; i<seg.size(); i++) {
| ~^~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
600 KB |
Output is correct |
2 |
Correct |
1 ms |
344 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 |
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 |
3 ms |
604 KB |
Output is correct |
2 |
Correct |
3 ms |
600 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
2 ms |
344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
748 KB |
Output is correct |
2 |
Correct |
6 ms |
732 KB |
Output is correct |
3 |
Correct |
9 ms |
748 KB |
Output is correct |
4 |
Correct |
3 ms |
748 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
748 KB |
Output is correct |
2 |
Correct |
8 ms |
748 KB |
Output is correct |
3 |
Correct |
12 ms |
748 KB |
Output is correct |
4 |
Correct |
3 ms |
744 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
748 KB |
Output is correct |
2 |
Correct |
8 ms |
748 KB |
Output is correct |
3 |
Correct |
11 ms |
732 KB |
Output is correct |
4 |
Correct |
3 ms |
732 KB |
Output is correct |
5 |
Correct |
4 ms |
748 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
74 ms |
4880 KB |
Output is correct |
2 |
Correct |
201 ms |
5816 KB |
Output is correct |
3 |
Correct |
123 ms |
3172 KB |
Output is correct |
4 |
Correct |
52 ms |
4896 KB |
Output is correct |
5 |
Correct |
48 ms |
3092 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
73 ms |
5044 KB |
Output is correct |
2 |
Correct |
61 ms |
4784 KB |
Output is correct |
3 |
Correct |
77 ms |
5036 KB |
Output is correct |
4 |
Correct |
51 ms |
5040 KB |
Output is correct |
5 |
Correct |
46 ms |
5952 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
161 ms |
5352 KB |
Output is correct |
2 |
Correct |
244 ms |
5120 KB |
Output is correct |
3 |
Correct |
286 ms |
5224 KB |
Output is correct |
4 |
Correct |
42 ms |
5564 KB |
Output is correct |
5 |
Correct |
77 ms |
5372 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
244 ms |
5708 KB |
Output is correct |
2 |
Correct |
290 ms |
5704 KB |
Output is correct |
3 |
Correct |
373 ms |
5700 KB |
Output is correct |
4 |
Correct |
42 ms |
5560 KB |
Output is correct |
5 |
Correct |
76 ms |
5668 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
73 ms |
5648 KB |
Output is correct |
2 |
Correct |
290 ms |
6192 KB |
Output is correct |
3 |
Correct |
390 ms |
5720 KB |
Output is correct |
4 |
Correct |
48 ms |
5548 KB |
Output is correct |
5 |
Correct |
78 ms |
5668 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1024 ms |
24332 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1064 ms |
24328 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1052 ms |
35680 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1025 ms |
37552 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1069 ms |
40332 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1058 ms |
42556 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1053 ms |
42444 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1054 ms |
43352 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1022 ms |
48272 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1016 ms |
48192 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |