# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1056882 |
2024-08-13T12:06:22 Z |
TimAni |
Mobile (BOI12_mobile) |
C++17 |
|
0 ms |
0 KB |
#include <bits/stdc++.h>
#define long long long
using namespace std;
const double eps = 1E-3;
const int N = (int) 1E6;
int n, k;
int x[N], y[N];
bool valid(double a) {
double t = 0;
for (int i = 0; i < n; i++) {
if (a < y[i]) {
continue;
}
double l = x[i] - sqrt(1.0 * a * a - 1.0 * y[i] * y[i]);
double r = x[i] + sqrt(1.0 * a * a - 1.0 * y[i] * y[i]);
if (l <= t && r >= t) {
t = r;
}
}
return t >= k;
}
void solve() {
cin >> n >> k;
for (int i = 0; i < n; i++) {
cin >> x[i] >> y[i];
}
double l = 0, r = 4E9;
while(r - l > eps) {
double R = (r + l) / 2;
if(valid(R)) {
r = R;
}
else {
l = R;
}
}
cout << fixed << setprecision(-log10(eps)) << r << endl;
}
int main() {
cin.tie(0)->sync_with_stdio(0);
double T = 1;
//cin >> T;
while(T--) solve();
return 0;
}a
Compilation message
mobile.cpp:53:2: error: 'a' does not name a type
53 | }a
| ^