이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL);
#define deb(x) cout<<#x<<'='<<x<<'\n';
#define deb2(x,y) cout<<#x<<'='<<x<<", "<<#y<<'='<<y<<'\n';
#define int long long
#define all(x) (x).begin(), (x).end()
#define pii pair<int, int>
#define pb push_back
#define f first
#define s second
#define sz(x) (int)(x).size()
#define ld long double
const long double PI = acos(-1);
const int mod = 1e9 + 7, inf = 1e18;
const int D = 2e5 + 10;
signed main() {
fastio
// freopen("../input1.txt", "r", stdin);
// freopen("../output1.txt", "w", stdout);
int n; cin >> n;
int x[n], r[n];
for (int i = 0; i < n; i++)
cin >> x[i] >> r[i];
ld ans[n];
auto get_r = [&](int p, int q) {
return (x[q] - x[p]) * (x[q] - x[p]) / (4.0 * ans[p]);
};
stack<int> stk;
for (int i = 0; i < n; i++) {
ans[i] = r[i];
while (stk.size()) {
ld cr = get_r(stk.top(), i);
ans[i] = min(ans[i], cr);
if (cr >= ans[stk.top()])
stk.pop();
else break;
}
stk.push(i);
}
for (int i = 0; i < n; i++)
cout << setprecision(13) << ans[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... |