이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
using lint = int64_t;
using ld = long double;
constexpr int _mod = int(1e9) + 7;
constexpr int _inf = 0x3f3f3f3f;
constexpr int _ninf = 0xcfcfcfcf;
constexpr lint _linf = 0x3f3f3f3f3f3f3f3f;
#define endl '\n'
int n;
vector<pair<ld,ld>> v;
stack<pair<ld,ld>> st;
ld solve(ld x, ld r) {
while(!st.empty()) {
auto [x1, r1] = st.top();
r = min(r, ((x1 - x) * (x1 - x)) / (4 * r1));
if(r1 > r) break;
st.pop();
}
st.push({x, r});
return r;
}
int main() {
cin.tie(nullptr)->sync_with_stdio(false);
cin >> n;
v.resize(n);
for(auto &i : v) {
cin >> i.first >> i.second;
};
for(int i = 0; i < n; i++) {
cout << fixed << setprecision(3) << solve(v[i].first, v[i].second) << endl;
}
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... |