# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
919091 | Em1L | Balloons (CEOI11_bal) | C++14 | 149 ms | 6480 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;
using ll = long long;
using pii = pair<int, double>;
int main() {
ios_base::sync_with_stdio(0); cin.tie(0);
cout << setprecision(3) << fixed;
int n; cin >> n;
stack < pii > st;
auto GetR = [&](pii A, int x) {
auto [x_, r_] = A;
return (x_ - x) * (x_ - x) / (4 * r_);
};
for (int i = 0, x, r; i < n; i++) {
cin >> x >> r;
double R = r;
while (!st.empty()) {
double curR = GetR(st.top(), x);
R = min(R, curR);
if (R >= st.top().second) {
st.pop();
} else {
break;
}
}
cout << R << "\n";
st.push(make_pair(x, R));
}
}
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... |