# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
954057 | blackslex | Balloons (CEOI11_bal) | C++17 | 90 ms | 8500 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;
int n;
int main() {
scanf("%d", &n);
vector<int> x(n), r(n);
vector<double> dp(n);
// dp[i] = min {0<=j<i} {(x[i]-x[j])*(x[i]-x[j]) / 4*dp[j]}
for (int i = 0; i < n; i++) scanf("%d %d", &x[i], &r[i]), dp[i] = (double) r[i];
stack<int> st;
for (int i = 0; i < n; i++) {
while (!st.empty() && (dp[i] = min(dp[i], (double) 1.0 * (x[st.top()] - x[i]) * (x[st.top()] - x[i]) / (4.0 * dp[st.top()]))) >= dp[st.top()]) st.pop();
st.emplace(i);
}
for (int i = 0; i < n; i++) printf("%.3lf\n", dp[i]);
}
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... |