이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define N 200005
#define fi first
#define se second
typedef pair<double, double> ii;
double res[N];
int n;
double cal(ii a, double bx){
return (bx - a.fi) * (bx - a.fi) / (4 * a.se);
}
signed main(){
ios_base::sync_with_stdio(0);
cin.tie(NULL);
stack<ii> st;
cin >> n;
for (int i = 1; i <= n; i++){
double r, x;
cin >> x >> r;
double mi = r;
while (!st.empty()){
ii tmp = st.top();
mi = min(mi, cal(tmp, x));
if (mi >= tmp.se) st.pop();
else break;
}
st.push({x, mi});
res[i] = mi;
}
cout << fixed << setprecision(3) ;
for (int i = 1; i <= n; i++){
cout << res[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... |