| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1330355 | randi_pav | Mobile (BOI12_mobile) | C++17 | 942 ms | 48680 KiB |
#include <bits/stdc++.h>
using namespace std;
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;
}
stack<long double> st;
stack<pair<long long, long long>> towers_;
towers_.push(towers[0]);
long double max_ = 0;
for (int i = 1; i < n; i++) {
while (!towers_.empty()) {
pair<long long, long long> temp = towers_.top();
long double result = (long double)towers[i].second * towers[i].second - (long double)temp.second * temp.second;
long double result2 = towers[i].first - temp.first;
long double result3 = towers[i].first + temp.first;
long double final_result = (result / result2 + result3) / 2.0;
if (st.empty() || st.top() <= final_result) {
st.push(final_result);
towers_.push(towers[i]);
long double x = final_result;
if(x < 0) x = 0;
if(x > l) x = l;
long double new_result = (x - towers[i].first) * (x - towers[i].first);
long double new_result2 = (long double)towers[i].second * towers[i].second;
max_ = max(sqrtl(new_result + new_result2), max_);
break;
} else {
st.pop();
towers_.pop();
}
}
}
max_ = max(max_, (long double)sqrtl((long double)towers[0].first * towers[0].first + (long double)towers[0].second * towers[0].second));
max_ = max(max_, (long double)sqrtl((long double)(l - towers[n-1].first) * (l - towers[n-1].first) + (long double)towers[n-1].second * towers[n-1].second));
cout << fixed << setprecision(3) << max_ << 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... | ||||
