| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1354033 | marcus06 | Balloons (CEOI11_bal) | C++20 | 52 ms | 5080 KiB |
#include <bits/stdc++.h>
using namespace std;
using lli = long long;
void solve() {
int n; cin >> n;
vector <int> x(n), rad(n);
for (int i = 0; i < n; ++i) {
cin >> x[i] >> rad[i];
}
vector <double> y(n);
auto calc = [&](int i, int j) -> double {
double dx = x[i] - x[j];
return min((double) rad[i], dx * dx / (4.0 * y[j]));
};
stack <int> st;
for (int i = 0; i < n; ++i) {
y[i] = rad[i];
if (!st.empty()) {
while (!st.empty()) {
y[i] = min(y[i], calc(i, st.top()));
if (y[i] >= y[st.top()]) st.pop();
else break;
}
}
st.push(i);
}
cout << setprecision(3) << fixed;
for (auto x: y) {
cout << x << '\n';
}
cout << '\n';
}
int main() {
std::cin.tie(0)->sync_with_stdio(0);
#ifdef LOCAL
auto begin = std::chrono::high_resolution_clock::now();
#endif
int tt = 1;
while (tt--) {
solve();
}
#ifdef LOCAL
auto end = std::chrono::high_resolution_clock::now();
auto elapsed = std::chrono::duration_cast<std::chrono::nanoseconds>(end - begin);
std::cerr << "Time measured: " << elapsed.count() * 1e-9 << " seconds.\n";
#endif
return 0;
}| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
