이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "bits/stdc++.h"
using namespace std;
#define N (1<<18) // 4194304
#define ld double
#define x first
#define r second
typedef pair<ld, ld> p;
ld rad(p b, p a){
return (b.x - a.x)*(b.x - a.x)/(4*a.r);
}
int main(){
int n; cin >> n;
vector<p> v(n);
vector<ld> r(n);
for(int i=0; i<n; ++i){ ld a, b; cin >> a >> b; v[i] = {a, b}; }
stack<p> st;
for(int i=0; i<n; ++i){
ld curr = v[i].r;
while(!st.empty()){
ld check = rad(v[i], st.top());
curr = min(curr,check);
if(check>=st.top().r){ st.pop(); continue; }
else break;
}
r[i] = curr;
st.push({v[i].x, curr});
}
for(int i=0; i<n; ++i) cout << fixed << setprecision(3) << r[i] << endl;
}
# | 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... |