This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int M=998244353;
void solve(){
int x;
cin>>x;
pair<int, int> arr[x];
long double ans[x];
for(int i=0; i<x; i++){
cin>>arr[i].first>>arr[i].second;
}
stack<pair<int, long double>> s;
for(int i=0; i<x; i++){
long double r=arr[i].second;
while(!s.empty()){
r=min(r, (arr[i].first-s.top().first)*(arr[i].first-s.top().first)/(4*s.top().second));
if(r>=s.top().second) s.pop();
else break;
}
ans[i]=r;
s.push({arr[i].first, ans[i]});
}
for(int i=0; i<x; i++) cout<<fixed<<setprecision(3)<<ans[i]<<'\n';
}
signed main(){
//freopen("in", "r", stdin); //freopen("out", "w", stdout);
cin.tie(0)->sync_with_stdio(0);
int t=1; //cin>>t;
while(t--) solve();
}
# | 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... |