이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
/* Online C++ Compiler and Editor */
#include <bits/stdc++.h>
#define f first
#define s second
typedef long double ld;
using namespace std;
int main()
{
int n; cin >> n;
vector<ld> x(n); vector<ld> r(n);
stack<pair<ld, ld>> mono;
auto eval = [&](pair<ld, ld> prev, ld x) -> ld {
return (prev.f - x) * (prev.f - x) / (4 * prev.s);
};
for (int i = 0; i < n; i++){
cin >> x[i] >> r[i];
while (!mono.empty()){
ld val = eval(mono.top(), x[i]);
r[i] = min(r[i], val);
if (mono.top().s <= val) {
mono.pop();
} else {
break;
}
}
mono.push({x[i], r[i]});
}
cout << fixed << setprecision(4) << '\n';
for (int i = 0; i < n; i++) cout << r[i] << '\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... |