# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1093060 | TommasoUlian | Mobile (BOI12_mobile) | C++17 | 720 ms | 45836 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
vector<pair<double, double>> torri;
ll n, L;
bool good(double r) {
queue<pair<double, double>> s;
for (auto a : torri) {
double x = a.first, y = a.second;
if (abs(y) <= r - 1e-6) { // Ensure we're within the valid range
double dx = sqrt((r + y) * (r - y));
s.push({x - dx, x + dx});
}
}
double curr = 0;
while (!s.empty()) {
if (curr >= L) return true; // Early exit if covered
auto seg = s.front();
s.pop();
if (seg.first <= curr) {
curr = max(seg.second, curr);
} else {
return false; // Can't cover this gap
}
}
return curr >= L; // Final check
}
void solve() {
cin >> n >> L;
torri.resize(n);
for (int i = 0; i < n; i++) {
cin >> torri[i].first >> torri[i].second;
}
double l = 1, r = 2e9; // Set realistic bounds
double ans = r;
while (r - l > 1e-4) { // Tighter precision for convergence
double c = (r + l) / 2;
if (good(c)) {
ans = c;
r = c;
} else {
l = c;
}
}
cout << setprecision(18) << (l + r) / 2 << endl;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
solve();
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |