이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define f first
#define s second
#define FAST ios_base::sync_with_stdio(0); cin.tie(0);
#define all(x) x.begin(),x.end()
typedef long double ld;
typedef pair<ld,ld> pi;
const int maxn = 200010;
const int INF = LLONG_MAX/2;
const int mod = 1e9+7;
int n;
ld x[maxn], r[maxn];
int32_t main() {
FAST
// #ifndef ONLINE_JUDGE
// ifstream cin("input.txt");
// #endif
cin >> n;
for (int i =1;i<=n;i++) cin >> x[i] >> r[i];
stack <pi> s;
for (int i =1;i<=n;i++) {
while (!s.empty()) {
auto [xp, rp] = s.top();
r[i] = min(r[i], (x[i] - xp) * (x[i] - xp) / (4 * rp));
if (r[i] >= rp) s.pop();
else break;
}
s.push(pi(x[i], r[i]));
}
for (int i =1;i<=n;i++) cout << fixed << setprecision(6) << r[i] << "\n";
}
# | 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... |