이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
// https://oj.uz/problem/view/CEOI11_bal
// Balloons
#include <bits/stdc++.h>
#define x first
#define r second
using namespace std;
typedef vector<int> vi;
typedef long double ld;
int main() {
int n;
cin >> n;
vector<pair<int, ld>> balls(n);
for (int i = 0; i < n; i++) {
cin >> balls[i].x >> balls[i].r;
}
// Stack algorithm
stack<pair<int, ld>> st;
vector<ld> radii(n);
for (int i = 0; i < n; i++) {
ld max_rad = balls[i].r;
while (!st.empty()) {
pair<int, ld> top = st.top();
max_rad = min(pow(balls[i].x - top.x, 2) / (4 * top.r), max_rad);
if (max_rad >= top.r) {
st.pop();
} else {
break;
}
}
st.push(make_pair(balls[i].x, max_rad));
radii[i] = max_rad;
}
for (ld r : radii) {
cout << r << "\n";
}
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... |