| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1330361 | randi_pav | Mobile (BOI12_mobile) | C++20 | 1097 ms | 65312 KiB |
#include <bits/stdc++.h>
using namespace std;
bool check(long double R, int n, int l, vector<pair<long long, long long>>& towers) {
vector<pair<long double, long double>> segments;
for (int i = 0; i < n; i++) {
if (R >= towers[i].second) {
long double d = sqrtl(R * R - (long double)towers[i].second * towers[i].second);
segments.push_back({(long double)towers[i].first - d, (long double)towers[i].first + d});
}
}
if (segments.empty()) return false;
sort(segments.begin(), segments.end());
long double current_reach = 0;
if (segments[0].first > 0) return false;
for (auto& seg : segments) {
if (seg.first <= current_reach) {
current_reach = max(current_reach, seg.second);
}
}
return current_reach >= (long double)l;
}
int main() {
int n, l;
cin >> n >> l;
vector<pair<long long, long long>> towers(n);
for (int i = 0; i < n; i++) cin >> towers[i].first >> towers[i].second;
long double low = 0, high = 2e9; // L aur coordinates ke hisaab se max possible distance
for (int i = 0; i < 100; i++) { // 100 iterations for high precision
long double mid = (low + high) / 2.0;
if (check(mid, n, l, towers)) high = mid;
else low = mid;
}
cout << fixed << setprecision(3) << high << endl;
return 0;
}| # | 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... | ||||
